// Console Class
#ifndef __CONSOLE_H__
#define __CONSOLE_H__
#pragma once
#include "Trohs.h"
#define FONT_SIZE 16
// The command tokens
typedef enum ConCmdToken
{
CONCMD_QUIT,
CONCMD_CLS,
CONCMD_TEXTURE,
CONCMD_LIGHT,
CONCMD_CULL,
CONCMD_HELP,
CONCMD_UNKNOWN
};
// The Console class is the main control point of the Engine. Any command can be done through here, towards the
// 3d Engine, the HW and the VM.
class Console
{
public:
HRESULT Init( D3d* d3 );
Console();
virtual ~Console();
bool IsActive() { return active; };
bool Toggle() { active = !active; return active; };
void Render();
void Clear();
void Print( char* s );
// This functions takes care of accepting input at a human rate
void InputManager( Input* in );
protected:
D3d* d3d;
bool active;
LPD3DXFONT pFont;
HFONT hFont;
int maxrow;
int maxcol;
int row, col;
int lastcmdrow;
char **text;
bool cursor;
bool capital;
bool Key( Input* in, int key );
bool PrintableKey( Input* in );
void DisplayChar( char c, bool shift = false, bool typed = false );
void ParseCommand( char* s );
ConCmdToken GetOpCode( char* s );
private:
// Hide to prevent bugs
Console& operator=( const Console& g );
Console( const Console& g );
};
#endif