Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/console.h')
-rw-r--r--src/client/console.h84
1 files changed, 50 insertions, 34 deletions
diff --git a/src/client/console.h b/src/client/console.h
index dc831b7..2f8d6a0 100644
--- a/src/client/console.h
+++ b/src/client/console.h
@@ -9,54 +9,70 @@
#include "sys/consoleinterface.h"
-#include <sstream>
-#include <deque>
+namespace client {
-const size_t MAXCONLINES = 2048;
-const size_t MAXHISTOLINES = 512;
const size_t MAXNOTIFYLINES = 3;
+const size_t MAXHISTOLINES = 512;
-namespace client {
+/// client console implementation
+class Console : public sys::ConsoleInterface {
+public:
+ Console();
+ virtual ~Console();
-/// the client console
-namespace console {
+ virtual void flush();
-/// initialize client console
-/** Adds the engine functions for the client console
- */
-void init();
+ void draw_console();
-/// shutdown the client console
-/** Removes the engine functions for the client console
- */
-void shutdown();
+ void draw_notify();
-/// flush buffer messages and print to stdout
-void flush();
-
-/// draw the console
-void draw();
+ /// clear notifications
+ void clear_notify();
-/// toggle the console on or off
-void toggle();
+ /// draw client notifications or console text
+ void draw();
-/// handle keyboard input
-void keypressed(int key);
+ /// toggle the console on or off
+ void toggle();
-/// true of the console is visible
-bool visible();
+ /// handle keyboard input
+ void keypressed(int key);
-/// load input history
-void load_history();
+ /// true of the console is visible
+ inline bool visible() { return console_visible; }
-/// save input history
-void save_history();
+ /// load input history
+ void load_history();
-extern size_t notify_pos;
-extern std::string notify_text[MAXNOTIFYLINES];
-extern float notify_time[MAXNOTIFYLINES];
+ /// save input history
+ void save_history();
-}
+ /// clear console
+ void clear();
+
+ /// initialize client console
+ static void init();
+
+ /// shutdown the client console
+ static void shutdown();
+
+private:
+ // notifications
+ size_t notify_pos;
+ std::string notify_text[MAXNOTIFYLINES];
+ float notify_time[MAXNOTIFYLINES];
+
+ // input history
+ std::deque<std::string> history;
+ std::deque<std::string>::reverse_iterator history_pos;
+ size_t input_pos;
+
+ bool console_visible;
+ size_t console_scroll;
+
+};
+
+Console *console();
}