Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 10768 was 10766, checked in by bknecht, 18 years ago

some finishing stuff

File size: 4.1 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
[10716]49  void setMode(Hud::Playmode playmode);
[10698]50  inline Hud::Playmode getMode() {return this->playmode;};
[8518]51
[10744]52  void getHit();
53
[10748]54  void tick(float dt);
55
[6437]56  void setBackGround();
[8145]57  void setEnergyWidget(OrxGui::GLGuiWidget* widget);
[10698]58  void setShieldWidget(OrxGui::GLGuiWidget* widget);
59  void setHealthWidget(OrxGui::GLGuiWidget* widget);
60  void setImplantWidget(OrxGui::GLGuiWidget* widget);
61
[10368]62  inline OrxGui::GLGuiWidget* getEnergyWidget() {return this->energyWidget;};
63  inline OrxGui::GLGuiWidget* getShieldWidget() {return this->shieldWidget;};
[10698]64  inline OrxGui::GLGuiWidget* getHealthWidget() {return this->healthWidget;};
65  inline OrxGui::GLGuiWidget* getImplantWidget() {return this->implantWidget;};
[3245]66
[10368]67  void setWeaponManager(WeaponManager* weaponMan, WeaponManager* weaponManSec = NULL);
68  inline void setRadarCenterNode(PNode* node) {this->radarCenterNode = node;};
69
[8145]70  void addWeaponWidget(OrxGui::GLGuiWidget* widget);
71  void removeWeaponWidget(OrxGui::GLGuiWidget* widget);
[6437]72
[8995]73  OrxGui::GLGuiRadar* radar() const { return _radar; };
74
[6443]75  void updateWeaponManager();
[10368]76  //void clearWeaponManager();
[6443]77
[10368]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
[6441]93  void draw() const;
[8990]94  virtual void process(const Event &event);
[6437]95
[8990]96
[6441]97  private:
98    void updateResolution();
[10716]99    void init();
[10368]100    //void createShipValuesBox();
[7062]101
[6438]102private:
[10758]103  unsigned int              resX;
104  unsigned int              resY;
[10748]105
[10758]106  float                     hitBarCount;
[10698]107 
[10758]108  Hud::Playmode             playmode; 
[3245]109
[10758]110  float                     travelZoneWidth; //the percentage of the screen, the player has got for his movements. should always be a value between 0 and 1;
[10368]111
[10758]112  OrxGui::GLGuiWidget*      energyWidget;
113  OrxGui::GLGuiWidget*      shieldWidget;
114  OrxGui::GLGuiWidget*      healthWidget;
115  OrxGui::GLGuiWidget*      implantWidget;
[10766]116  OrxGui::GLGuiText*        healthText;
117  OrxGui::GLGuiText*        shieldText;
[6437]118
[10758]119  OrxGui::GLGuiNotifier*    notifier;
120  OrxGui::GLGuiInputLine*   inputLine;
121  OrxGui::GLGuiRadar*       _radar;
122  PNode*                    radarCenterNode;
[8518]123
[10748]124  bool                  ifinit;
[10759]125  bool                  hidden;
[10748]126
[10368]127  OrxGui::GLGuiWidget*     rightRect;
128  OrxGui::GLGuiWidget*     leftRect;
[10698]129  OrxGui::GLGuiWidget*          topRect;
130  OrxGui::GLGuiWidget*          bottomRect;
131  OrxGui::GLGuiWidget*          middleRect;
[10741]132  OrxGui::GLGuiImage*           barSocket;
133  //OrxGui::GLGuiImage*         topHit;
134  //OrxGui::GLGuiImage*         bottomHit;
[10716]135  OrxGui::GLGuiImage*           leftHit;
136  OrxGui::GLGuiImage*           rightHit;
[10368]137  bool                     overlayActive;
138  int                      overlayPercentage; //the percentage of the screen, the player has got for his movements. should always be a value between 0 and 1;
139
[6442]140  WeaponManager*           weaponManager;
[10368]141  WeaponManager*           weaponManagerSecondary;
[6442]142
[10368]143  std::list<OrxGui::GLGuiEnergyWidgetVertical*> weaponsWidgetsPrim; //!< WeaponWidgets will be displayed one after another
144  std::list<OrxGui::GLGuiEnergyWidgetVertical*> weaponsWidgetsSec;
[1853]145};
146
[6437]147#endif /* _HUD_H */
Note: See TracBrowser for help on using the repository browser.