Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/playability/src/util/hud.h @ 10275

Last change on this file since 10275 was 10270, checked in by muellmic, 19 years ago

1) the centerpoint of the radar is now the centerpoint of the camera, so the enemies won't move in the radar when the player is moving; 2)fovy and cameradistance of each viewmode can now be set dynamically. so one would't have to readjust the fovy for each viewmode, when it has been manually changed once. (it's better to just change the fovy or distance for the viewmode where you need it); 3)unlike in the last revision, it doesnt have a soft- zoom- effect when setting a fovy anymore.

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
57  inline void setOverlayPercentage(int perc) 
58  {
59    if (perc > 100) perc = 100;
60    else if (perc < 0) perc = 0;
61
62    this->overlayPercentage = perc;
63    updateResolution();
64  };
65
66  inline void setOverlayActive(bool b)
67  {
68    overlayActive = b;
69    updateResolution();
70  };
71
72  void draw() const;
73  virtual void process(const Event &event);
74
75
76  private:
77    void updateResolution();
78    //void createShipValuesBox();
79
80private:
81  unsigned int             resX;
82  unsigned int             resY;
83
84  float                    travelZoneWidth; //the percentage of the screen, the player has got for his movements. should always be a value between 0 and 1;
85
86  OrxGui::GLGuiWidget*     energyWidget;
87  OrxGui::GLGuiWidget*     shieldWidget;
88  OrxGui::GLGuiWidget*     armorWidget;
89
90  OrxGui::GLGuiNotifier*   notifier;
91  OrxGui::GLGuiInputLine*  inputLine;
92  OrxGui::GLGuiRadar*      _radar;
93  PNode*                   radarCenterNode;
94
95  OrxGui::GLGuiWidget*     rightRect;
96  OrxGui::GLGuiWidget*     leftRect;
97  bool                     overlayActive;
98  int                      overlayPercentage; //the percentage of the screen, the player has got for his movements. should always be a value between 0 and 1;
99
100  WeaponManager*           weaponManager;
101  WeaponManager*           weaponManagerSecondary;
102
103  std::list<OrxGui::GLGuiEnergyWidgetVertical*> weaponsWidgetsPrim; //!< WeaponWidgets will be displayed one after another
104  std::list<OrxGui::GLGuiEnergyWidgetVertical*> weaponsWidgetsSec;
105};
106
107#endif /* _HUD_H */
Note: See TracBrowser for help on using the repository browser.