X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fconsole.hpp;h=3543cf62ab496e6e0a50a9bbf3cb775a259ea59d;hb=5667d7e94d85f968ab914bc457edd689fc907253;hp=94043e80de12620756c735416ceb50ae71ae6a66;hpb=5c53cc30550b59d512a4bb73888af8cbc43ebb4f;p=supertux.git diff --git a/src/console.hpp b/src/console.hpp index 94043e80d..3543cf62a 100644 --- a/src/console.hpp +++ b/src/console.hpp @@ -26,6 +26,7 @@ #include #include #include +#include #include class Console; @@ -43,12 +44,13 @@ public: 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 input(char c); /**< add character to inputBuffer */ + void backspace(); /**< delete character left of inputBufferPosition */ + void eraseChar(); /**< delete character at inputBufferPosition */ 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 */ @@ -105,7 +107,8 @@ private: float stayOpen; - static ConsoleStreamBuffer inputBuffer; /**< stream buffer used by input stream */ + static int inputBufferPosition; /**< position in inputBuffer before which to append new characters */ + static std::string inputBuffer; /**< string used for keyboard input */ static ConsoleStreamBuffer outputBuffer; /**< stream buffer used by output stream */ void addLines(std::string s); /**< display a string of (potentially) multiple lines in the console */