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