- public:
- Console();
- ~Console();
-
- static std::ostream input; /**< stream of keyboard input to send to the console. Do not forget to send std::endl or to flush the stream. */
- static std::ostream output; /**< stream of characters to output to the console. Do not forget to send std::endl or to flush the stream. */
-
- static void backspace(); /**< delete last character sent to the input stream */
- static void scroll(int offset); /**< scroll console text up or down by @c offset lines */
- static void autocomplete(); /**< autocomplete current command */
-
- void draw(DrawingContext& context); /**< draw the console in a DrawingContext */
- static void show(); /**< display the console */
- static void hide(); /**< hide the console */
- static void toggle(); /**< display the console if hidden, hide otherwise */
-
- static bool hasFocus(); /**< true if characters should be sent to the console instead of their normal target */
- static void registerCommand(std::string command, ConsoleCommandReceiver* ccr); /**< associate command with the given CCR */
- static void unregisterCommand(std::string command, ConsoleCommandReceiver* ccr); /**< dissociate command and CCR */
- static void unregisterCommands(ConsoleCommandReceiver* ccr); /**< dissociate all commands of given CCR */
-
- template<typename T> static bool string_is(std::string s) {
- std::istringstream iss(s);
- T i;
- if ((iss >> i) && iss.eof()) {
- return true;
- } else {
- return false;
- }
+public:
+ Console();
+ ~Console();
+
+ static Console* instance;
+
+ static std::ostream input; /**< stream of keyboard input to send to the console. Do not forget to send std::endl or to flush the stream. */
+ static std::ostream output; /**< stream of characters to output to the console. Do not forget to send std::endl or to flush the stream. */
+
+ void init_graphics();
+
+ void backspace(); /**< delete last character sent to the input stream */
+ void scroll(int offset); /**< scroll console text up or down by @c offset lines */
+ void autocomplete(); /**< autocomplete current command */
+ void show_history(int offset); /**< move @c offset lines forward through history; Negative offset moves backward */
+
+ void draw(DrawingContext& context); /**< draw the console in a DrawingContext */
+ void update(float elapsed_time);
+
+ void show(); /**< display the console */
+ void hide(); /**< hide the console */
+ void toggle(); /**< display the console if hidden, hide otherwise */
+
+ bool hasFocus(); /**< true if characters should be sent to the console instead of their normal target */
+ void registerCommand(std::string command, ConsoleCommandReceiver* ccr); /**< associate command with the given CCR */
+ void unregisterCommand(std::string command, ConsoleCommandReceiver* ccr); /**< dissociate command and CCR */
+ void unregisterCommands(ConsoleCommandReceiver* ccr); /**< dissociate all commands of given CCR */
+
+ template<typename T> static bool string_is(std::string s) {
+ std::istringstream iss(s);
+ T i;
+ if ((iss >> i) && iss.eof()) {
+ return true;
+ } else {
+ return false;