Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: first fruits of valgrind…. delete[] are fine now :)

File size: 2.7 KB
RevLine 
[4838]1/*!
[5068]2 * @file shell.h
3 * Definition of a on-screen-shell
[5204]4 *
5 * @todo check for smooth deletion process
[5208]6 * @todo Buffer Display in different Colors for different debug mode.
[5204]7 */
[1853]8
[5068]9#ifndef _SHELL_H
10#define _SHELL_H
[1853]11
[5068]12#include "element_2d.h"
[5069]13#include "event_listener.h"
[1853]14
[5068]15#include <stdarg.h>
16
[4838]17// FORWARD DECLARATION
[5068]18class Text;
[5179]19class ShellInput;
[5141]20class ShellCommandBase;
[5068]21template<class T> class tList;
[5118]22template<class T> class tIterator;
[3543]23
[5068]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 tell check itself in to the Shell, and listen for commands.
33 *
34 * @todo implement what is written above :/
35 */
[5069]36class Shell : public Element2D, public EventListener {
[3543]37
[5068]38  public:
[5206]39    Shell();
[5068]40    virtual ~Shell();
[2036]41
[5113]42    void activate();
43    void deactivate();
[5197]44    /** @returns true if the Shell is active, false otherwise. */
[5176]45    inline bool isActive() const { return this->bActive; };
[1853]46
[5113]47    void setTextSize(unsigned int textSize, unsigned int lineSpacing = 1);
48    void rebuildText();
[3245]49
[5175]50    // BUFFERS
[5113]51    void setBufferDisplaySize(unsigned int bufferDisplaySize);
[5118]52    void printToDisplayBuffer(const char* text);
[5183]53    void flush();
[3245]54
[5130]55    void clear();
56
[5069]57    // EventListener
58    virtual void process(const Event &event);
[5068]59    // Element2D-functions
60    virtual void draw() const;
61
62    void debug() const;
63
64  private:
[5120]65    // helpers //
66    Vector calculateLinePosition(unsigned int lineNumber);
[5113]67
[5183]68    //     void testI (int i);
69    //     void testS (const char* s);
70    //     void testB (bool b);
71    //     void testF (float f);
72    //     void testSF (const char* s, float f);
73
[5068]74  private:
75
[5180]76    // GENERAL
77    bool                     bActive;                //!< if the shell is active;
78    unsigned int             shellHeight;            //!< The hight of the Shell in Pixels
79    unsigned int             lineSpacing;            //!< The Spacing between lines.
80    unsigned int             textSize;               //!< The size of the text.
[5208]81    char*                    textFont;               //!< The file containing the font.
[5068]82
[5175]83    // HANDLING TEXT INPUT
[5197]84    ShellInput*              shellInput;             //!< The inputLine of the Shell.
[5180]85    // BUFFER
86    unsigned int             bufferDisplaySize;      //!< The Size of the Display-buffer, in lines (not in characters)
[5129]87    Text**                   bufferText;             //!< A list of stored bufferTexts for the display of the buffer
[1853]88};
89
[5068]90#endif /* _SHELL_H */
Note: See TracBrowser for help on using the repository browser.