Line | |
---|
1 | /*! |
---|
2 | * @file glgui_radar.h |
---|
3 | * @brief Definition of an Radar, that displays a bar and a Text |
---|
4 | */ |
---|
5 | |
---|
6 | #ifndef _GLGUI_RADAR_H |
---|
7 | #define _GLGUI_RADAR_H |
---|
8 | |
---|
9 | #include "glgui_widget.h" |
---|
10 | |
---|
11 | class PNode; |
---|
12 | class WorldEntity; |
---|
13 | |
---|
14 | namespace OrxGui |
---|
15 | { |
---|
16 | |
---|
17 | //! A class for ... |
---|
18 | class GLGuiRadar : public GLGuiWidget |
---|
19 | { |
---|
20 | public: |
---|
21 | typedef enum { |
---|
22 | Linear, |
---|
23 | Exponential, |
---|
24 | } Attenuation; |
---|
25 | |
---|
26 | public: |
---|
27 | GLGuiRadar(); |
---|
28 | virtual ~GLGuiRadar(); |
---|
29 | |
---|
30 | void addEntityList(const std::list<WorldEntity*>* entityList, const Color& color); |
---|
31 | void removeEntityList(const std::list<WorldEntity*>* entityList); |
---|
32 | |
---|
33 | void setRange(float range); |
---|
34 | |
---|
35 | void setCenterNode(const PNode* center); |
---|
36 | void setUpdateInterval(float updateInterval) { this->_updateInterval = updateInterval; }; |
---|
37 | void setAttenuation(Attenuation attenuation); |
---|
38 | |
---|
39 | |
---|
40 | float range() const { return this->_range; } |
---|
41 | |
---|
42 | void updateRadar(); |
---|
43 | |
---|
44 | virtual void tick(float dt); |
---|
45 | void draw() const; |
---|
46 | |
---|
47 | protected: |
---|
48 | virtual void resize(); |
---|
49 | virtual void showing(); |
---|
50 | virtual void hiding(); |
---|
51 | |
---|
52 | private: |
---|
53 | void init(); |
---|
54 | |
---|
55 | private: |
---|
56 | typedef struct |
---|
57 | { |
---|
58 | Color dotColor; |
---|
59 | const std::list<WorldEntity*>* entityList; |
---|
60 | std::vector<Vector2D> positions; |
---|
61 | } |
---|
62 | DotList; |
---|
63 | |
---|
64 | const PNode* _centerNode; |
---|
65 | std::vector<DotList> _dotLists; |
---|
66 | |
---|
67 | Attenuation _attenuation; |
---|
68 | float _range; |
---|
69 | |
---|
70 | |
---|
71 | float _updateInterval; |
---|
72 | float _timePassed; |
---|
73 | }; |
---|
74 | } |
---|
75 | #endif /* _GLGUI_RADAR_H */ |
---|
Note: See
TracBrowser
for help on using the repository browser.