/*! * @file shell.h * Definition of a on-screen-shell */ #ifndef _SHELL_H #define _SHELL_H #include "element_2d.h" #include "event_listener.h" #include #include // FORWARD DECLARATION class Text; template class tList; //! A class that is able to redirect all output to a openGL-Shell, and that one can use to input some commands /** * the major idea is, that all the Output can be redirected to the Shell, * and does not have to be displayed to the opening Shell, this is good, * for developers using Windows, where all output is otherwise redirected * to stdout.txt * * Furthermore the Shell should enable us, to input some simple commands * Each Class can tell check itself in to the Shell, and listen for commands. * * @todo implement what is written above :/ */ class Shell : public Element2D, public EventListener { public: virtual ~Shell(); /** @returns a Pointer to the only object of this Class */ inline static Shell* getInstance(void) { if (!Shell::singletonRef) Shell::singletonRef = new Shell(); return Shell::singletonRef; }; void setBufferSize(unsigned int bufferSize) { this->bufferSize = bufferSize; }; void setBufferDisplaySize(unsigned int bufferDisplaySize); // BUFFER // void flushBuffers(); void addBufferLine(const char* Line, va_list args); void moveBuffer(int lineCount); const char* getBufferLine(unsigned int lineNumber); // InputLine void flushInputLine(); void addCharacter(char character); void addCharacters(const char* characters); void removeCharacters(unsigned int characterCount = 1); // EventListener virtual void process(const Event &event); // Element2D-functions void tick(float dt); virtual void draw() const; void debug() const; private: bool autoComplete(); private: Shell(); static Shell* singletonRef; unsigned int bufferSize; unsigned int bufferDisplaySize; char* inputLine; tList* buffer; tList* bufferText; //!< A list of sored bufferLines of the Shell Text* inputLineText; //!< The inputLine of the Shell }; #endif /* _SHELL_H */