X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fconsole.hpp;h=59d393486816cde1605e21d5c573e8c1bc995a6a;hb=665b4a4a6b0edae82fb830528f16d2176da44aa4;hp=83ea2fe070bdb9b1eadece012782afc993233a60;hpb=c0caa810fcbd6f6a09c0078fdf2d30a4a6cb7bc9;p=supertux.git diff --git a/src/console.hpp b/src/console.hpp index 83ea2fe07..59d393486 100644 --- a/src/console.hpp +++ b/src/console.hpp @@ -43,15 +43,18 @@ 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 */ 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); @@ -103,7 +106,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 */