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 | |
---|
9 | #ifndef _GLGUI_NOTIFIER_H |
---|
10 | #define _GLGUI_NOTIFIER_H |
---|
11 | |
---|
12 | #include "glgui_widget.h" |
---|
13 | #include "event_listener.h" |
---|
14 | |
---|
15 | #include <stack> |
---|
16 | |
---|
17 | // FORWARD DECLARATION |
---|
18 | class MultiLineText; |
---|
19 | class Text; |
---|
20 | |
---|
21 | //! Namespace of the GLGuiNotifier of ORXONOX. |
---|
22 | namespace OrxGui |
---|
23 | { |
---|
24 | class GLGuiNotifier : public GLGuiWidget |
---|
25 | { |
---|
26 | ObjectListDeclaration(GLGuiNotifier); |
---|
27 | public: |
---|
28 | GLGuiNotifier(); |
---|
29 | virtual ~GLGuiNotifier(); |
---|
30 | |
---|
31 | void pushNotifyMessage(const std::string& message); |
---|
32 | |
---|
33 | /// Setup |
---|
34 | void setDisplayLineCount(unsigned int count); |
---|
35 | void setFadeAge(float fadeAge); |
---|
36 | void setHideAge(float hideAge); |
---|
37 | |
---|
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 | |
---|
43 | void clear(); |
---|
44 | |
---|
45 | // Element2D-functions |
---|
46 | virtual void tick(float dt); |
---|
47 | virtual void draw() const; |
---|
48 | |
---|
49 | void debug() const; |
---|
50 | |
---|
51 | protected: |
---|
52 | virtual void resize(); |
---|
53 | |
---|
54 | private: |
---|
55 | void repositionText(); |
---|
56 | void applyTextSettings(MultiLineText* text); |
---|
57 | void applySettings(); |
---|
58 | // helpers // |
---|
59 | Vector2D calculateLinePosition(unsigned int lineNumber); |
---|
60 | |
---|
61 | |
---|
62 | |
---|
63 | private: |
---|
64 | //! structure that defines a Displayed line. |
---|
65 | typedef struct |
---|
66 | { |
---|
67 | float age; |
---|
68 | MultiLineText* text; |
---|
69 | |
---|
70 | } |
---|
71 | DisplayLine; |
---|
72 | |
---|
73 | |
---|
74 | float _fadeAge; |
---|
75 | float _hideAge; |
---|
76 | float _transformAge; |
---|
77 | |
---|
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). |
---|
82 | std::list<DisplayLine> displayLines; //!< A list of stored bufferTexts for the display of the buffer. |
---|
83 | |
---|
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. |
---|
88 | std::list<std::string> inputBuffer; //!< The input buffer for lines that were not yet printet out, because there is too much input. |
---|
89 | |
---|
90 | }; |
---|
91 | |
---|
92 | } |
---|
93 | |
---|
94 | #endif /* _GLGUI_NOTIFIER_H */ |
---|