Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/presentation/src/util/hud.h @ 10758

Last change on this file since 10758 was 10758, checked in by nicolasc, 17 years ago

added shield functionality, reverted paeddae's MP patch - does not work

File size: 4.0 KB
Line 
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
16class WeaponManager;
17namespace 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).
25class Hud : public Element2D, public EventListener
26{
27  ObjectListDeclaration(Hud);
28
29public:
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 
41  Hud();
42  virtual ~Hud();
43
44
45  virtual void loadParams(const TiXmlElement* root);
46
47  void notifyUser(const std::string& message);
48
49  void setMode(Hud::Playmode playmode);
50  inline Hud::Playmode getMode() {return this->playmode;};
51
52  void getHit();
53
54  void tick(float dt);
55
56  void setBackGround();
57  void setEnergyWidget(OrxGui::GLGuiWidget* widget);
58  void setShieldWidget(OrxGui::GLGuiWidget* widget);
59  void setHealthWidget(OrxGui::GLGuiWidget* widget);
60  void setImplantWidget(OrxGui::GLGuiWidget* widget);
61
62  inline OrxGui::GLGuiWidget* getEnergyWidget() {return this->energyWidget;};
63  inline OrxGui::GLGuiWidget* getShieldWidget() {return this->shieldWidget;};
64  inline OrxGui::GLGuiWidget* getHealthWidget() {return this->healthWidget;};
65  inline OrxGui::GLGuiWidget* getImplantWidget() {return this->implantWidget;};
66
67  void setWeaponManager(WeaponManager* weaponMan, WeaponManager* weaponManSec = NULL);
68  inline void setRadarCenterNode(PNode* node) {this->radarCenterNode = node;};
69
70  void addWeaponWidget(OrxGui::GLGuiWidget* widget);
71  void removeWeaponWidget(OrxGui::GLGuiWidget* widget);
72
73  OrxGui::GLGuiRadar* radar() const { return _radar; };
74
75  void updateWeaponManager();
76  //void clearWeaponManager();
77
78  inline void setOverlayPercentage(int perc) 
79  {
80    if (perc > 100) perc = 100;
81    else if (perc < 0) perc = 0;
82
83    this->overlayPercentage = perc;
84    updateResolution();
85  };
86
87  inline void setOverlayActive(bool b)
88  {
89    overlayActive = b;
90    updateResolution();
91  };
92
93  void draw() const;
94  virtual void process(const Event &event);
95
96
97  private:
98    void updateResolution();
99    void init();
100    //void createShipValuesBox();
101
102private:
103  unsigned int              resX;
104  unsigned int              resY;
105
106  float                     hitBarCount;
107 
108  Hud::Playmode             playmode; 
109
110  float                     travelZoneWidth; //the percentage of the screen, the player has got for his movements. should always be a value between 0 and 1;
111
112  OrxGui::GLGuiWidget*      energyWidget;
113  OrxGui::GLGuiWidget*      shieldWidget;
114  OrxGui::GLGuiWidget*      healthWidget;
115  OrxGui::GLGuiWidget*      implantWidget;
116
117  OrxGui::GLGuiNotifier*    notifier;
118  OrxGui::GLGuiInputLine*   inputLine;
119  OrxGui::GLGuiRadar*       _radar;
120  PNode*                    radarCenterNode;
121
122  bool                  ifinit;
123
124  OrxGui::GLGuiWidget*     rightRect;
125  OrxGui::GLGuiWidget*     leftRect;
126  OrxGui::GLGuiWidget*          topRect;
127  OrxGui::GLGuiWidget*          bottomRect;
128  OrxGui::GLGuiWidget*          middleRect;
129  OrxGui::GLGuiImage*           barSocket;
130  //OrxGui::GLGuiImage*         topHit;
131  //OrxGui::GLGuiImage*         bottomHit;
132  OrxGui::GLGuiImage*           leftHit;
133  OrxGui::GLGuiImage*           rightHit;
134  bool                     overlayActive;
135  int                      overlayPercentage; //the percentage of the screen, the player has got for his movements. should always be a value between 0 and 1;
136
137  WeaponManager*           weaponManager;
138  WeaponManager*           weaponManagerSecondary;
139
140  std::list<OrxGui::GLGuiEnergyWidgetVertical*> weaponsWidgetsPrim; //!< WeaponWidgets will be displayed one after another
141  std::list<OrxGui::GLGuiEnergyWidgetVertical*> weaponsWidgetsSec;
142};
143
144#endif /* _HUD_H */
Note: See TracBrowser for help on using the repository browser.