X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fconsole.hpp;h=94043e80de12620756c735416ceb50ae71ae6a66;hb=d4b281559d45406a5d07cf04d89142cdeb90b114;hp=15d9791cbd144ec532c12d947fc96a7993c5c325;hpb=a113d3bd1feddd510e3b2852b0d42522735eee40;p=supertux.git diff --git a/src/console.hpp b/src/console.hpp index 15d9791cb..94043e80d 100644 --- a/src/console.hpp +++ b/src/console.hpp @@ -49,9 +49,11 @@ public: void init_graphics(); void backspace(); /**< delete last character sent to the input stream */ + void enter(); /**< process and clear 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 move_cursor(int offset); /**< move the cursor @c offset chars to the right; Negative offset moves backward; 0xFFFF moves to the end */ void draw(DrawingContext& context); /**< draw the console in a DrawingContext */ void update(float elapsed_time); @@ -61,9 +63,6 @@ public: 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 static bool string_is(std::string s) { std::istringstream iss(s); @@ -89,7 +88,6 @@ private: std::list history; /**< command history. New lines get added to back. */ std::list::iterator history_position; /**< item of command history that is currently displayed */ std::list lines; /**< backbuffer of lines sent to the console. New lines get added to front. */ - std::map > commands; /**< map of console commands and a list of associated ConsoleCommandReceivers */ std::auto_ptr background; /**< console background image */ std::auto_ptr background2; /**< second, moving console background image */ @@ -138,19 +136,4 @@ class ConsoleStreamBuffer : public std::stringbuf } }; -class ConsoleCommandReceiver -{ -public: - virtual ~ConsoleCommandReceiver() - { - Console::instance->unregisterCommands(this); - } - - /** - * callback from Console; return false if command was unknown, - * true otherwise - */ - virtual bool consoleCommand(std::string command, std::vector arguments) = 0; -}; - #endif