- 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 */
-
- protected:
- static std::list<std::string> lines; /**< backbuffer of lines sent to the console */
- static std::map<std::string, std::list<ConsoleCommandReceiver*> > commands; /**< map of console commands and a list of associated ConsoleCommandReceivers */
- Surface* background; /**< console background image */
- Surface* background2; /**< second, moving console background image */
- static int backgroundOffset; /**< current offset of scrolling background image */
- static int height; /**< height of the console in px */
- static int offset; /**< decrease to scroll text up */
- static bool focused; /**< true if console has input focus */
-
- static ConsoleStreamBuffer inputBuffer; /**< stream buffer used by input stream */
- static ConsoleStreamBuffer outputBuffer; /**< stream buffer used by output stream */
-
- static void addLine(std::string s); /**< display a line in the console */
- static void parse(std::string s); /**< react to a given command */
-
- friend class ConsoleStreamBuffer;
- static void flush(ConsoleStreamBuffer* buffer); /**< act upon changes in a ConsoleStreamBuffer */
-};