Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/util/hud.h @ 10411

Last change on this file since 10411 was 10368, checked in by patrick, 18 years ago

merged the branche playability into the trunk

File size: 2.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  Hud();
31  virtual ~Hud();
32
33
34  virtual void loadParams(const TiXmlElement* root);
35
36  void notifyUser(const std::string& message);
37
38
39  void setBackGround();
40  void setEnergyWidget(OrxGui::GLGuiWidget* widget);
41  void setShiledWidget(OrxGui::GLGuiWidget* widget);
42  void setArmorWidget(OrxGui::GLGuiWidget* widget);
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
47  void setWeaponManager(WeaponManager* weaponMan, WeaponManager* weaponManSec = NULL);
48  inline void setRadarCenterNode(PNode* node) {this->radarCenterNode = node;};
49
50  void addWeaponWidget(OrxGui::GLGuiWidget* widget);
51  void removeWeaponWidget(OrxGui::GLGuiWidget* widget);
52
53  OrxGui::GLGuiRadar* radar() const { return _radar; };
54
55  void updateWeaponManager();
56  //void clearWeaponManager();
57
58  inline void setOverlayPercentage(int perc) 
59  {
60    if (perc > 100) perc = 100;
61    else if (perc < 0) perc = 0;
62
63    this->overlayPercentage = perc;
64    updateResolution();
65  };
66
67  inline void setOverlayActive(bool b)
68  {
69    overlayActive = b;
70    updateResolution();
71  };
72
73  void draw() const;
74  virtual void process(const Event &event);
75
76
77  private:
78    void updateResolution();
79    //void createShipValuesBox();
80
81private:
82  unsigned int             resX;
83  unsigned int             resY;
84
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
87  OrxGui::GLGuiWidget*     energyWidget;
88  OrxGui::GLGuiWidget*     shieldWidget;
89  OrxGui::GLGuiWidget*     armorWidget;
90
91  OrxGui::GLGuiNotifier*   notifier;
92  OrxGui::GLGuiInputLine*  inputLine;
93  OrxGui::GLGuiRadar*      _radar;
94  PNode*                   radarCenterNode;
95
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;
100
101  WeaponManager*           weaponManager;
102  WeaponManager*           weaponManagerSecondary;
103
104  std::list<OrxGui::GLGuiEnergyWidgetVertical*> weaponsWidgetsPrim; //!< WeaponWidgets will be displayed one after another
105  std::list<OrxGui::GLGuiEnergyWidgetVertical*> weaponsWidgetsSec;
106};
107
108#endif /* _HUD_H */
Note: See TracBrowser for help on using the repository browser.