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
RevLine 
[4838]1/*!
[5068]2 * @file shell.h
3 * Definition of a on-screen-shell
[5204]4 *
[5208]5 * @todo Buffer Display in different Colors for different debug mode.
[5204]6 */
[1853]7
[5068]8#ifndef _SHELL_H
9#define _SHELL_H
[1853]10
[5068]11#include "element_2d.h"
[5069]12#include "event_listener.h"
[1853]13
[5068]14#include <stdarg.h>
15
[4838]16// FORWARD DECLARATION
[5068]17class Text;
[5179]18class ShellInput;
[5118]19template<class T> class tIterator;
[3543]20
[5068]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
[5246]29 * Each Class can check itself in to the Shell, and listen for commands.
[5068]30 *
[5246]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 !!
[5068]38 */
[5069]39class Shell : public Element2D, public EventListener {
[3543]40
[5068]41  public:
[5206]42    Shell();
[5068]43    virtual ~Shell();
[2036]44
[5113]45    void activate();
46    void deactivate();
[5197]47    /** @returns true if the Shell is active, false otherwise. */
[5176]48    inline bool isActive() const { return this->bActive; };
[1853]49
[5251]50    void setFont(const char* fontFile);
[5113]51    void setTextSize(unsigned int textSize, unsigned int lineSpacing = 1);
52    void rebuildText();
[3245]53
[5175]54    // BUFFERS
[5113]55    void setBufferDisplaySize(unsigned int bufferDisplaySize);
[5118]56    void printToDisplayBuffer(const char* text);
[5246]57    void moveDisplayBuffer(int lineCount);
58
[5183]59    void flush();
[3245]60
[5130]61    void clear();
62
[5069]63    // EventListener
64    virtual void process(const Event &event);
[5068]65    // Element2D-functions
66    virtual void draw() const;
67
68    void debug() const;
69
70  private:
[5120]71    // helpers //
72    Vector calculateLinePosition(unsigned int lineNumber);
[5113]73
[5183]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
[5068]80  private:
[5180]81    // GENERAL
[5246]82    bool                     bActive;                //!< If the shell is active.
83    unsigned int             shellHeight;            //!< The hight of the Shell in Pixels.
[5180]84    unsigned int             lineSpacing;            //!< The Spacing between lines.
85    unsigned int             textSize;               //!< The size of the text.
[5251]86    char*                    fontFile;               //!< The file containing the font.
[5068]87
[5175]88    // HANDLING TEXT INPUT
[5197]89    ShellInput*              shellInput;             //!< The inputLine of the Shell.
[5180]90    // BUFFER
[5246]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.
[5247]94    tIterator<char>*         bufferIterator;         //!< used to move through and print the Buffer
[1853]95};
96
[5068]97#endif /* _SHELL_H */
Note: See TracBrowser for help on using the repository browser.