From a185c11f2397c0296a4b62cc266b4fa00a63c1e2 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Wed, 14 May 2008 21:07:10 +0000 Subject: console, camera & interpolation --- src/client/console.h | 84 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 50 insertions(+), 34 deletions(-) (limited to 'src/client/console.h') 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 -#include +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 history; + std::deque::reverse_iterator history_pos; + size_t input_pos; + + bool console_visible; + size_t console_scroll; + +}; + +Console *console(); } -- cgit v1.2.3