Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 10698 was 10698, checked in by snellen, 17 years ago

merged adm, hud, vs-enhancements : beni's responsible for this commit. blame him!

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