Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: saver change between fonts in Shell

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