Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: minimalized the ShellBuffer

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