Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/util/shell.h @ 5073

Last change on this file since 5073 was 5072, checked in by bensch, 20 years ago

orxonox/trunk: started function implementation for Shell

File size: 2.6 KB
RevLine 
[4838]1/*!
[5068]2 * @file shell.h
3 * Definition of a on-screen-shell
[3245]4*/
[1853]5
[5068]6#ifndef _SHELL_H
7#define _SHELL_H
[1853]8
[5068]9#include "element_2d.h"
[5069]10#include "event_listener.h"
[1853]11
[5068]12#include <stdio.h>
13#include <stdarg.h>
14
15
[4838]16// FORWARD DECLARATION
[5068]17class Text;
18template<class T> class tList;
[3543]19
[5068]20//! A class that is able to redirect all output to a openGL-Shell, and that one can use to input some commands
21/**
22 * the major idea is, that all the Output can be redirected to the Shell,
23 * and does not have to be displayed to the opening Shell, this is good,
24 * for developers using Windows, where all output is otherwise redirected
25 * to stdout.txt
26 *
27 * Furthermore the Shell should enable us, to input some simple commands
28 * Each Class can tell check itself in to the Shell, and listen for commands.
29 *
30 * @todo implement what is written above :/
31 */
[5069]32class Shell : public Element2D, public EventListener {
[3543]33
[5068]34  public:
35    virtual ~Shell();
36    /** @returns a Pointer to the only object of this Class */
[5072]37    inline static Shell* getInstance() { if (!Shell::singletonRef) Shell::singletonRef = new Shell();  return Shell::singletonRef; };
[2036]38
[1853]39
[5068]40    void setBufferSize(unsigned int bufferSize) { this->bufferSize = bufferSize; };
[1853]41
[5068]42    void setBufferDisplaySize(unsigned int bufferDisplaySize);
[3245]43
[5068]44    // BUFFER //
45    void flushBuffers();
46    void addBufferLine(const char* Line, va_list args);
47    void moveBuffer(int lineCount);
48    const char* getBufferLine(unsigned int lineNumber);
[3245]49
[5069]50    // InputLine
[5068]51    void flushInputLine();
52    void addCharacter(char character);
53    void addCharacters(const char* characters);
54    void removeCharacters(unsigned int characterCount = 1);
55
56
[5069]57    // EventListener
58    virtual void process(const Event &event);
59
[5068]60    // Element2D-functions
61    void tick(float dt);
62    virtual void draw() const;
63
64    void debug() const;
65
66  private:
67    bool autoComplete();
68
69
70  private:
71    Shell();
[5072]72    static Shell*          singletonRef;           //!< The singleton-reference to the only memeber of this class.
[5068]73
[5072]74    unsigned int           bufferSize;             //!< The Size of the buffer
75    unsigned int           bufferDisplaySize;      //!< The Size of the Display-buffer, in lines (not in characters)
[5068]76
[5072]77    char*                  inputLine;              //!< the Char-Array of the Buffer
[5068]78
[5072]79    tList<char>*           buffer;                 //!< A list of stored char-arrays(strings) to store the history
[5068]80
[5072]81    tList<Text>*           bufferText;             //!< A list of stored bufferTexts for the display of the buffer
[5068]82    Text*                  inputLineText;          //!< The inputLine of the Shell
[1853]83};
84
[5068]85#endif /* _SHELL_H */
Note: See TracBrowser for help on using the repository browser.