00001 #pragma once
00002
00003 #include <string>
00004 #include <map>
00005 #include <vector>
00006 #include "defines.h"
00007 #include "messages.h"
00008
00009 #define MAX_CIRCULAR_LIST_SIZE 100
00010
00011 using namespace std;
00012
00013 typedef void(*pointerToFunc)(string);
00014
00015 namespace zak {
00016
00021 class ZAKENGINE_API Console {
00022 public:
00023 static void Initialize();
00024
00028 static void Clear();
00029
00034 static void Trace(string str);
00035
00040 static void Trace(const char *str, ...);
00041
00049 static string ReadLine();
00050
00055 static bool IsEmpty() { return (_writeCursor == _readCursor); }
00056
00062 static bool ExecuteCommand(string input);
00063
00074 static bool RegisterCommand(string cmd, pointerToFunc func);
00075
00076 static vector<string> _lastCommands;
00077 static int _lastCmdCursor;
00078
00079 private:
00080 static map<string, pointerToFunc> _commands;
00081 static vector<string> _vector;
00082 static string _buffer[MAX_CIRCULAR_LIST_SIZE];
00083 static int _readCursor;
00084 static int _writeCursor;
00085
00086 static void Help(string help);
00087 static void InsertString (string str);
00088 };
00089
00090 }