[8498] | 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 choose color of the Font and the background. |
---|
| 7 | */ |
---|
| 8 | |
---|
[8503] | 9 | #ifndef _GLGUI_NOTIFIER_H |
---|
| 10 | #define _GLGUI_NOTIFIER_H |
---|
[8498] | 11 | |
---|
| 12 | #include "glgui_widget.h" |
---|
| 13 | #include "event_listener.h" |
---|
| 14 | |
---|
[8509] | 15 | #include <stack> |
---|
| 16 | |
---|
[8498] | 17 | // FORWARD DECLARATION |
---|
| 18 | class MultiLineText; |
---|
[8503] | 19 | class Text; |
---|
[8498] | 20 | |
---|
[8503] | 21 | //! Namespace of the GLGuiNotifier of ORXONOX. |
---|
[8498] | 22 | namespace OrxGui |
---|
| 23 | { |
---|
[8503] | 24 | class GLGuiNotifier : public GLGuiWidget |
---|
[8498] | 25 | { |
---|
[9869] | 26 | ObjectListDeclaration(GLGuiNotifier); |
---|
[8498] | 27 | public: |
---|
[8503] | 28 | GLGuiNotifier(); |
---|
| 29 | virtual ~GLGuiNotifier(); |
---|
[8498] | 30 | |
---|
| 31 | void pushNotifyMessage(const std::string& message); |
---|
| 32 | |
---|
[8619] | 33 | /// Setup |
---|
[8509] | 34 | void setDisplayLineCount(unsigned int count); |
---|
[8619] | 35 | void setFadeAge(float fadeAge); |
---|
| 36 | void setHideAge(float hideAge); |
---|
[8498] | 37 | |
---|
[8619] | 38 | /** @returns the beginning of the Hiding process */ |
---|
| 39 | inline float fadeAge() const { return _fadeAge; }; |
---|
| 40 | /** @returns at what age elements should be fully hidden */ |
---|
| 41 | inline float hideAge() const { return _hideAge; }; |
---|
| 42 | |
---|
[8498] | 43 | void clear(); |
---|
| 44 | |
---|
| 45 | // Element2D-functions |
---|
| 46 | virtual void tick(float dt); |
---|
| 47 | virtual void draw() const; |
---|
| 48 | |
---|
| 49 | void debug() const; |
---|
| 50 | |
---|
[8509] | 51 | protected: |
---|
| 52 | virtual void resize(); |
---|
| 53 | |
---|
[8498] | 54 | private: |
---|
| 55 | void repositionText(); |
---|
[8509] | 56 | void applyTextSettings(MultiLineText* text); |
---|
[8498] | 57 | void applySettings(); |
---|
| 58 | // helpers // |
---|
| 59 | Vector2D calculateLinePosition(unsigned int lineNumber); |
---|
| 60 | |
---|
[8509] | 61 | |
---|
| 62 | |
---|
[8498] | 63 | private: |
---|
[8619] | 64 | //! structure that defines a Displayed line. |
---|
[8509] | 65 | typedef struct |
---|
| 66 | { |
---|
| 67 | float age; |
---|
| 68 | MultiLineText* text; |
---|
| 69 | |
---|
[9869] | 70 | } |
---|
| 71 | DisplayLine; |
---|
[8509] | 72 | |
---|
[8619] | 73 | |
---|
| 74 | float _fadeAge; |
---|
| 75 | float _hideAge; |
---|
| 76 | float _transformAge; |
---|
| 77 | |
---|
[8498] | 78 | unsigned int lineSpacing; //!< The Spacing between lines. |
---|
| 79 | |
---|
| 80 | // BUFFER |
---|
| 81 | unsigned int bufferDisplaySize; //!< The Size of the Display-buffer, in lines (not in characters). |
---|
[8509] | 82 | std::list<DisplayLine> displayLines; //!< A list of stored bufferTexts for the display of the buffer. |
---|
[8498] | 83 | |
---|
[8509] | 84 | std::stack<MultiLineText*> hiddenText; //!< Text that is not shown, and not used is thrown in here |
---|
| 85 | |
---|
| 86 | |
---|
| 87 | unsigned long linesProcessed; //!< How many Lines have been processed so far. |
---|
[8619] | 88 | std::list<std::string> inputBuffer; //!< The input buffer for lines that were not yet printet out, because there is too much input. |
---|
[8509] | 89 | |
---|
[8498] | 90 | }; |
---|
| 91 | |
---|
| 92 | } |
---|
| 93 | |
---|
[8503] | 94 | #endif /* _GLGUI_NOTIFIER_H */ |
---|