[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); |
---|
[10270] | 48 | inline void setRadarCenterNode(PNode* node) {this->radarCenterNode = node;}; |
---|
[3245] | 49 | |
---|
[8145] | 50 | void addWeaponWidget(OrxGui::GLGuiWidget* widget); |
---|
| 51 | void removeWeaponWidget(OrxGui::GLGuiWidget* widget); |
---|
[6437] | 52 | |
---|
[8995] | 53 | OrxGui::GLGuiRadar* radar() const { return _radar; }; |
---|
| 54 | |
---|
[6443] | 55 | void updateWeaponManager(); |
---|
[10278] | 56 | //void clearWeaponManager(); |
---|
[6443] | 57 | |
---|
[10233] | 58 | inline void setOverlayPercentage(int perc) |
---|
[10230] | 59 | { |
---|
[10233] | 60 | if (perc > 100) perc = 100; |
---|
| 61 | else if (perc < 0) perc = 0; |
---|
[10230] | 62 | |
---|
[10233] | 63 | this->overlayPercentage = perc; |
---|
| 64 | updateResolution(); |
---|
[10230] | 65 | }; |
---|
| 66 | |
---|
[10233] | 67 | inline void setOverlayActive(bool b) |
---|
| 68 | { |
---|
| 69 | overlayActive = b; |
---|
| 70 | updateResolution(); |
---|
| 71 | }; |
---|
| 72 | |
---|
[6441] | 73 | void draw() const; |
---|
[8990] | 74 | virtual void process(const Event &event); |
---|
[6437] | 75 | |
---|
[8990] | 76 | |
---|
[6441] | 77 | private: |
---|
| 78 | void updateResolution(); |
---|
[10194] | 79 | //void createShipValuesBox(); |
---|
[7062] | 80 | |
---|
[6438] | 81 | private: |
---|
[6441] | 82 | unsigned int resX; |
---|
| 83 | unsigned int resY; |
---|
[3245] | 84 | |
---|
[10230] | 85 | float travelZoneWidth; //the percentage of the screen, the player has got for his movements. should always be a value between 0 and 1; |
---|
| 86 | |
---|
[8145] | 87 | OrxGui::GLGuiWidget* energyWidget; |
---|
| 88 | OrxGui::GLGuiWidget* shieldWidget; |
---|
| 89 | OrxGui::GLGuiWidget* armorWidget; |
---|
[6437] | 90 | |
---|
[8518] | 91 | OrxGui::GLGuiNotifier* notifier; |
---|
| 92 | OrxGui::GLGuiInputLine* inputLine; |
---|
[8995] | 93 | OrxGui::GLGuiRadar* _radar; |
---|
[10270] | 94 | PNode* radarCenterNode; |
---|
[8518] | 95 | |
---|
[10233] | 96 | OrxGui::GLGuiWidget* rightRect; |
---|
| 97 | OrxGui::GLGuiWidget* leftRect; |
---|
| 98 | bool overlayActive; |
---|
| 99 | int overlayPercentage; //the percentage of the screen, the player has got for his movements. should always be a value between 0 and 1; |
---|
[10230] | 100 | |
---|
[6442] | 101 | WeaponManager* weaponManager; |
---|
[9965] | 102 | WeaponManager* weaponManagerSecondary; |
---|
[6442] | 103 | |
---|
[10230] | 104 | std::list<OrxGui::GLGuiEnergyWidgetVertical*> weaponsWidgetsPrim; //!< WeaponWidgets will be displayed one after another |
---|
| 105 | std::list<OrxGui::GLGuiEnergyWidgetVertical*> weaponsWidgetsSec; |
---|
[1853] | 106 | }; |
---|
| 107 | |
---|
[6437] | 108 | #endif /* _HUD_H */ |
---|