#include <string>
#include <sstream>
#include <iostream>
+#include <squirrel.h>
class Console;
class ConsoleStreamBuffer;
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);
}
private:
- std::list<std::string> lines; /**< backbuffer of lines sent to the console */
+ std::list<std::string> history; /**< command history. New lines get added to back. */
+ std::list<std::string>::iterator history_position; /**< item of command history that is currently displayed */
+ std::list<std::string> lines; /**< backbuffer of lines sent to the console. New lines get added to front. */
std::map<std::string, std::list<ConsoleCommandReceiver*> > commands; /**< map of console commands and a list of associated ConsoleCommandReceivers */
std::auto_ptr<Surface> background; /**< console background image */
std::auto_ptr<Surface> background2; /**< second, moving console background image */
+
+ HSQUIRRELVM vm; /**< squirrel thread for the console (with custom roottable */
+ HSQOBJECT vm_object;
int backgroundOffset; /**< current offset of scrolling background image */
float height; /**< height of the console in px */
int offset; /**< decrease to scroll text up */
bool focused; /**< true if console has input focus */
std::auto_ptr<Font> font;
+ float fontheight; /**< height of the font (this is a separate var, because the font could not be initialized yet but is needed in the addLine message */
float stayOpen;