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 | |
---|
13 | |
---|
14 | // FORWARD DECLARATION |
---|
15 | class WeaponManager; |
---|
16 | namespace OrxGui { |
---|
17 | class GLGuiWidget; |
---|
18 | class GLGuiNotifier; |
---|
19 | class GLGuiInputLine; |
---|
20 | class GLGuiRadar; |
---|
21 | } |
---|
22 | |
---|
23 | //! A class that renders a HUD (Heads Up Display for User Information). |
---|
24 | class Hud : public Element2D, public EventListener |
---|
25 | { |
---|
26 | ObjectListDeclaration(Hud); |
---|
27 | |
---|
28 | public: |
---|
29 | Hud(); |
---|
30 | virtual ~Hud(); |
---|
31 | |
---|
32 | |
---|
33 | virtual void loadParams(const TiXmlElement* root); |
---|
34 | |
---|
35 | void notifyUser(const std::string& message); |
---|
36 | |
---|
37 | |
---|
38 | void setBackGround(); |
---|
39 | void setEnergyWidget(OrxGui::GLGuiWidget* widget); |
---|
40 | void setShiledWidget(OrxGui::GLGuiWidget* widget); |
---|
41 | void setArmorWidget(OrxGui::GLGuiWidget* widget); |
---|
42 | inline OrxGui::GLGuiWidget* getEnergyWidget() {return this->energyWidget;}; |
---|
43 | inline OrxGui::GLGuiWidget* getShieldWidget() {return this->shieldWidget;}; |
---|
44 | inline OrxGui::GLGuiWidget* getArmorWidget() {return this->armorWidget;}; |
---|
45 | |
---|
46 | void setWeaponManager(WeaponManager* weaponMan, WeaponManager* weaponManSec = NULL); |
---|
47 | |
---|
48 | void addWeaponWidget(OrxGui::GLGuiWidget* widget); |
---|
49 | void removeWeaponWidget(OrxGui::GLGuiWidget* widget); |
---|
50 | |
---|
51 | OrxGui::GLGuiRadar* radar() const { return _radar; }; |
---|
52 | |
---|
53 | void updateWeaponManager(); |
---|
54 | |
---|
55 | void draw() const; |
---|
56 | virtual void process(const Event &event); |
---|
57 | |
---|
58 | |
---|
59 | private: |
---|
60 | void updateResolution(); |
---|
61 | void createShipValuesBox(); |
---|
62 | |
---|
63 | private: |
---|
64 | unsigned int resX; |
---|
65 | unsigned int resY; |
---|
66 | |
---|
67 | OrxGui::GLGuiWidget* energyWidget; |
---|
68 | OrxGui::GLGuiWidget* shieldWidget; |
---|
69 | OrxGui::GLGuiWidget* armorWidget; |
---|
70 | OrxGui::GLGuiBox* shipValuesBox; |
---|
71 | |
---|
72 | OrxGui::GLGuiNotifier* notifier; |
---|
73 | OrxGui::GLGuiInputLine* inputLine; |
---|
74 | OrxGui::GLGuiRadar* _radar; |
---|
75 | |
---|
76 | WeaponManager* weaponManager; |
---|
77 | WeaponManager* weaponManagerSecondary; |
---|
78 | |
---|
79 | std::list<OrxGui::GLGuiWidget*> weaponsWidgets; //!< WeaponWidgets will be displayed one after another |
---|
80 | }; |
---|
81 | |
---|
82 | #endif /* _HUD_H */ |
---|