[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" |
---|
[10368] | 11 | #include "glgui_box.h" |
---|
| 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: |
---|
[10685] | 30 | |
---|
| 31 | typedef enum { |
---|
| 32 | Vertical = 1, //!< Vertical (seen from left or right/move in x-z) |
---|
| 33 | Horizontal = 2, //!< Horizontal (seet from the top/move in x-y) |
---|
| 34 | FromBehind = 4, //!< Seen from behind (move in z-y) |
---|
| 35 | Full3D = 8, //!< Full featured 3D-mode. (move in all directions x-y-z) |
---|
| 36 | FirstPerson = 16, |
---|
| 37 | |
---|
| 38 | PlaymodeCount = 5, |
---|
| 39 | } Playmode; |
---|
| 40 | |
---|
[6437] | 41 | Hud(); |
---|
| 42 | virtual ~Hud(); |
---|
[1853] | 43 | |
---|
[6441] | 44 | |
---|
[6512] | 45 | virtual void loadParams(const TiXmlElement* root); |
---|
[6438] | 46 | |
---|
[8518] | 47 | void notifyUser(const std::string& message); |
---|
| 48 | |
---|
[10685] | 49 | inline void setMode(Hud::Playmode playmode) {this->playmode = playmode;}; |
---|
| 50 | inline Hud::Playmode getMode() {return this->playmode;}; |
---|
[8518] | 51 | |
---|
[6437] | 52 | void setBackGround(); |
---|
[8145] | 53 | void setEnergyWidget(OrxGui::GLGuiWidget* widget); |
---|
[10685] | 54 | void setShieldWidget(OrxGui::GLGuiWidget* widget); |
---|
| 55 | void setHealthWidget(OrxGui::GLGuiWidget* widget); |
---|
| 56 | void setImplantWidget(OrxGui::GLGuiWidget* widget); |
---|
[10368] | 57 | inline OrxGui::GLGuiWidget* getEnergyWidget() {return this->energyWidget;}; |
---|
| 58 | inline OrxGui::GLGuiWidget* getShieldWidget() {return this->shieldWidget;}; |
---|
[10685] | 59 | inline OrxGui::GLGuiWidget* getHealthWidget() {return this->healthWidget;}; |
---|
| 60 | inline OrxGui::GLGuiWidget* getImplantWidget() {return this->implantWidget;}; |
---|
[3245] | 61 | |
---|
[10368] | 62 | void setWeaponManager(WeaponManager* weaponMan, WeaponManager* weaponManSec = NULL); |
---|
| 63 | inline void setRadarCenterNode(PNode* node) {this->radarCenterNode = node;}; |
---|
| 64 | |
---|
[8145] | 65 | void addWeaponWidget(OrxGui::GLGuiWidget* widget); |
---|
| 66 | void removeWeaponWidget(OrxGui::GLGuiWidget* widget); |
---|
[6437] | 67 | |
---|
[8995] | 68 | OrxGui::GLGuiRadar* radar() const { return _radar; }; |
---|
| 69 | |
---|
[6443] | 70 | void updateWeaponManager(); |
---|
[10368] | 71 | //void clearWeaponManager(); |
---|
[6443] | 72 | |
---|
[10368] | 73 | inline void setOverlayPercentage(int perc) |
---|
| 74 | { |
---|
| 75 | if (perc > 100) perc = 100; |
---|
| 76 | else if (perc < 0) perc = 0; |
---|
| 77 | |
---|
| 78 | this->overlayPercentage = perc; |
---|
| 79 | updateResolution(); |
---|
| 80 | }; |
---|
| 81 | |
---|
| 82 | inline void setOverlayActive(bool b) |
---|
| 83 | { |
---|
| 84 | overlayActive = b; |
---|
| 85 | updateResolution(); |
---|
| 86 | }; |
---|
| 87 | |
---|
[6441] | 88 | void draw() const; |
---|
[8990] | 89 | virtual void process(const Event &event); |
---|
[6437] | 90 | |
---|
[8990] | 91 | |
---|
[6441] | 92 | private: |
---|
| 93 | void updateResolution(); |
---|
[10368] | 94 | //void createShipValuesBox(); |
---|
[7062] | 95 | |
---|
[6438] | 96 | private: |
---|
[6441] | 97 | unsigned int resX; |
---|
| 98 | unsigned int resY; |
---|
[10685] | 99 | |
---|
| 100 | Hud::Playmode playmode; |
---|
[3245] | 101 | |
---|
[10368] | 102 | float travelZoneWidth; //the percentage of the screen, the player has got for his movements. should always be a value between 0 and 1; |
---|
| 103 | |
---|
[8145] | 104 | OrxGui::GLGuiWidget* energyWidget; |
---|
| 105 | OrxGui::GLGuiWidget* shieldWidget; |
---|
[10685] | 106 | OrxGui::GLGuiWidget* healthWidget; |
---|
| 107 | OrxGui::GLGuiWidget* implantWidget; |
---|
[6437] | 108 | |
---|
[8518] | 109 | OrxGui::GLGuiNotifier* notifier; |
---|
| 110 | OrxGui::GLGuiInputLine* inputLine; |
---|
[8995] | 111 | OrxGui::GLGuiRadar* _radar; |
---|
[10368] | 112 | PNode* radarCenterNode; |
---|
[8518] | 113 | |
---|
[10368] | 114 | OrxGui::GLGuiWidget* rightRect; |
---|
| 115 | OrxGui::GLGuiWidget* leftRect; |
---|
[10685] | 116 | OrxGui::GLGuiWidget* topRect; |
---|
| 117 | OrxGui::GLGuiWidget* bottomRect; |
---|
| 118 | OrxGui::GLGuiWidget* middleRect; |
---|
| 119 | OrxGui::GLGuiWidget* barSocket; |
---|
[10368] | 120 | bool overlayActive; |
---|
| 121 | int overlayPercentage; //the percentage of the screen, the player has got for his movements. should always be a value between 0 and 1; |
---|
| 122 | |
---|
[6442] | 123 | WeaponManager* weaponManager; |
---|
[10368] | 124 | WeaponManager* weaponManagerSecondary; |
---|
[6442] | 125 | |
---|
[10368] | 126 | std::list<OrxGui::GLGuiEnergyWidgetVertical*> weaponsWidgetsPrim; //!< WeaponWidgets will be displayed one after another |
---|
| 127 | std::list<OrxGui::GLGuiEnergyWidgetVertical*> weaponsWidgetsSec; |
---|
[1853] | 128 | }; |
---|
| 129 | |
---|
[6437] | 130 | #endif /* _HUD_H */ |
---|