00001 00007 #ifndef _CONSOLE_H_ 00008 #define _CONSOLE_H_ 00009 00010 #include "../Common/OS/Windows.h" 00011 #include "../Common/Globals.h" 00012 #include "String.h" 00013 #include "LinkedList.h" 00014 #include "Log.h" 00015 #include "../Math/Vector.h" 00016 #include "OpenGL/OpenGLFont.h" 00017 //#include "../Game/GGlobals.h" 00018 #include "../Game/Player.h" 00019 00020 00021 extern SPlayer g_players[SPLAYER_MAX_PLAYERS]; // hrm 00022 extern int g_myPlayerID; 00023 extern Gne *gne; 00024 00025 struct ConsoleEntry { 00026 String str; 00027 Vec3 clr; 00028 float time; 00029 }; 00030 00031 class Console { 00032 public: 00033 Console(); 00034 virtual ~Console(); 00035 00036 void handleKey(unsigned int key); 00037 void handleChar(char ch); 00038 void process(); 00039 void add(const char *str, Vec3 clr = Vec3(1.0f, 1.0f, 1.0f)); 00040 void addEx(Vec3 clr, const char *str, ...); 00041 00042 virtual void draw(OpenGLFont *font) = 0; 00043 00044 protected: 00045 bool parse(char *str, char **cmd, char **param); 00046 00047 protected: 00048 String console; 00049 unsigned int pos; 00050 LinkedList <ConsoleEntry> history; 00051 }; 00052 00053 #endif