1 | /*! |
---|
2 | * @file hud.h |
---|
3 | * @brief Definition of the ingame HUD. |
---|
4 | */ |
---|
5 | |
---|
6 | #ifndef _HUD_H |
---|
7 | #define _HUD_H |
---|
8 | |
---|
9 | #include "element_2d.h" |
---|
10 | #include "event_listener.h" |
---|
11 | #include "glgui_box.h" |
---|
12 | #include "elements/glgui_energywidgetvertical.h" |
---|
13 | |
---|
14 | |
---|
15 | // FORWARD DECLARATION |
---|
16 | class WeaponManager; |
---|
17 | namespace OrxGui { |
---|
18 | class GLGuiWidget; |
---|
19 | class GLGuiNotifier; |
---|
20 | class GLGuiInputLine; |
---|
21 | class GLGuiRadar; |
---|
22 | } |
---|
23 | |
---|
24 | //! A class that renders a HUD (Heads Up Display for User Information). |
---|
25 | class Hud : public Element2D, public EventListener |
---|
26 | { |
---|
27 | ObjectListDeclaration(Hud); |
---|
28 | |
---|
29 | public: |
---|
30 | Hud(); |
---|
31 | virtual ~Hud(); |
---|
32 | |
---|
33 | |
---|
34 | virtual void loadParams(const TiXmlElement* root); |
---|
35 | |
---|
36 | void notifyUser(const std::string& message); |
---|
37 | |
---|
38 | |
---|
39 | void setBackGround(); |
---|
40 | void setEnergyWidget(OrxGui::GLGuiWidget* widget); |
---|
41 | void setShiledWidget(OrxGui::GLGuiWidget* widget); |
---|
42 | void setArmorWidget(OrxGui::GLGuiWidget* widget); |
---|
43 | inline OrxGui::GLGuiWidget* getEnergyWidget() {return this->energyWidget;}; |
---|
44 | inline OrxGui::GLGuiWidget* getShieldWidget() {return this->shieldWidget;}; |
---|
45 | inline OrxGui::GLGuiWidget* getArmorWidget() {return this->armorWidget;}; |
---|
46 | |
---|
47 | void setWeaponManager(WeaponManager* weaponMan, WeaponManager* weaponManSec = NULL); |
---|
48 | |
---|
49 | void addWeaponWidget(OrxGui::GLGuiWidget* widget); |
---|
50 | void removeWeaponWidget(OrxGui::GLGuiWidget* widget); |
---|
51 | |
---|
52 | OrxGui::GLGuiRadar* radar() const { return _radar; }; |
---|
53 | |
---|
54 | void updateWeaponManager(); |
---|
55 | |
---|
56 | inline void setOverlayPercentage(int perc) |
---|
57 | { |
---|
58 | if (perc > 100) perc = 100; |
---|
59 | else if (perc < 0) perc = 0; |
---|
60 | |
---|
61 | this->overlayPercentage = perc; |
---|
62 | updateResolution(); |
---|
63 | }; |
---|
64 | |
---|
65 | inline void setOverlayActive(bool b) |
---|
66 | { |
---|
67 | overlayActive = b; |
---|
68 | updateResolution(); |
---|
69 | }; |
---|
70 | |
---|
71 | void draw() const; |
---|
72 | virtual void process(const Event &event); |
---|
73 | |
---|
74 | |
---|
75 | private: |
---|
76 | void updateResolution(); |
---|
77 | //void createShipValuesBox(); |
---|
78 | |
---|
79 | private: |
---|
80 | unsigned int resX; |
---|
81 | unsigned int resY; |
---|
82 | |
---|
83 | float travelZoneWidth; //the percentage of the screen, the player has got for his movements. should always be a value between 0 and 1; |
---|
84 | |
---|
85 | OrxGui::GLGuiWidget* energyWidget; |
---|
86 | OrxGui::GLGuiWidget* shieldWidget; |
---|
87 | OrxGui::GLGuiWidget* armorWidget; |
---|
88 | |
---|
89 | OrxGui::GLGuiNotifier* notifier; |
---|
90 | OrxGui::GLGuiInputLine* inputLine; |
---|
91 | OrxGui::GLGuiRadar* _radar; |
---|
92 | |
---|
93 | OrxGui::GLGuiWidget* rightRect; |
---|
94 | OrxGui::GLGuiWidget* leftRect; |
---|
95 | bool overlayActive; |
---|
96 | int overlayPercentage; //the percentage of the screen, the player has got for his movements. should always be a value between 0 and 1; |
---|
97 | |
---|
98 | WeaponManager* weaponManager; |
---|
99 | WeaponManager* weaponManagerSecondary; |
---|
100 | |
---|
101 | std::list<OrxGui::GLGuiEnergyWidgetVertical*> weaponsWidgetsPrim; //!< WeaponWidgets will be displayed one after another |
---|
102 | std::list<OrxGui::GLGuiEnergyWidgetVertical*> weaponsWidgetsSec; |
---|
103 | }; |
---|
104 | |
---|
105 | #endif /* _HUD_H */ |
---|