Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/shell/shell.h @ 5243

Last change on this file since 5243 was 5243, checked in by bensch, 19 years ago

orxonox/trunk: now it is possible to get old commands from the List

File size: 2.7 KB
Line 
1/*!
2 * @file shell.h
3 * Definition of a on-screen-shell
4 *
5 * @todo Buffer Display in different Colors for different debug mode.
6 */
7
8#ifndef _SHELL_H
9#define _SHELL_H
10
11#include "element_2d.h"
12#include "event_listener.h"
13
14#include <stdarg.h>
15
16// FORWARD DECLARATION
17class Text;
18class ShellInput;
19class ShellCommandBase;
20template<class T> class tList;
21template<class T> class tIterator;
22
23//! A class that is able to redirect all output to a openGL-Shell, and that one can use to input some commands
24/**
25 * the major idea is, that all the Output can be redirected to the Shell,
26 * and does not have to be displayed to the opening Shell, this is good,
27 * for developers using Windows, where all output is otherwise redirected
28 * to stdout.txt
29 *
30 * Furthermore the Shell should enable us, to input some simple commands
31 * Each Class can tell check itself in to the Shell, and listen for commands.
32 *
33 * @todo implement what is written above :/
34 */
35class Shell : public Element2D, public EventListener {
36
37  public:
38    Shell();
39    virtual ~Shell();
40
41    void activate();
42    void deactivate();
43    /** @returns true if the Shell is active, false otherwise. */
44    inline bool isActive() const { return this->bActive; };
45
46    void setTextSize(unsigned int textSize, unsigned int lineSpacing = 1);
47    void rebuildText();
48
49    // BUFFERS
50    void setBufferDisplaySize(unsigned int bufferDisplaySize);
51    void printToDisplayBuffer(const char* text);
52    void flush();
53
54    void clear();
55
56    // EventListener
57    virtual void process(const Event &event);
58    // Element2D-functions
59    virtual void draw() const;
60
61    void debug() const;
62
63  private:
64    // helpers //
65    Vector calculateLinePosition(unsigned int lineNumber);
66
67    //     void testI (int i);
68    //     void testS (const char* s);
69    //     void testB (bool b);
70    //     void testF (float f);
71    //     void testSF (const char* s, float f);
72
73  private:
74
75    // GENERAL
76    bool                     bActive;                //!< if the shell is active;
77    unsigned int             shellHeight;            //!< The hight of the Shell in Pixels
78    unsigned int             lineSpacing;            //!< The Spacing between lines.
79    unsigned int             textSize;               //!< The size of the text.
80    char*                    textFont;               //!< The file containing the font.
81
82    // HANDLING TEXT INPUT
83    ShellInput*              shellInput;             //!< The inputLine of the Shell.
84    // BUFFER
85    unsigned int             bufferDisplaySize;      //!< The Size of the Display-buffer, in lines (not in characters)
86    Text**                   bufferText;             //!< A list of stored bufferTexts for the display of the buffer
87};
88
89#endif /* _SHELL_H */
Note: See TracBrowser for help on using the repository browser.