Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 10744 was 10744, checked in by bknecht, 17 years ago

does not segfault anymore

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