Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 10262 was 10233, checked in by muellmic, 18 years ago

energy bars are now changing its colors, adding hud overlay - very strange coordinate behaviour tough, awaiting fix

File size: 2.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"
[10111]11#include "glgui_box.h"
[10230]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:
[6437]30  Hud();
31  virtual ~Hud();
[1853]32
[6441]33
[6512]34  virtual void loadParams(const TiXmlElement* root);
[6438]35
[8518]36  void notifyUser(const std::string& message);
37
38
[6437]39  void setBackGround();
[8145]40  void setEnergyWidget(OrxGui::GLGuiWidget* widget);
41  void setShiledWidget(OrxGui::GLGuiWidget* widget);
42  void setArmorWidget(OrxGui::GLGuiWidget* widget);
[10139]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
[9965]47  void setWeaponManager(WeaponManager* weaponMan, WeaponManager* weaponManSec = NULL);
[3245]48
[8145]49  void addWeaponWidget(OrxGui::GLGuiWidget* widget);
50  void removeWeaponWidget(OrxGui::GLGuiWidget* widget);
[6437]51
[8995]52  OrxGui::GLGuiRadar* radar() const { return _radar; };
53
[6443]54  void updateWeaponManager();
55
[10233]56  inline void setOverlayPercentage(int perc) 
[10230]57  {
[10233]58    if (perc > 100) perc = 100;
59    else if (perc < 0) perc = 0;
[10230]60
[10233]61    this->overlayPercentage = perc;
62    updateResolution();
[10230]63  };
64
[10233]65  inline void setOverlayActive(bool b)
66  {
67    overlayActive = b;
68    updateResolution();
69  };
70
[6441]71  void draw() const;
[8990]72  virtual void process(const Event &event);
[6437]73
[8990]74
[6441]75  private:
76    void updateResolution();
[10194]77    //void createShipValuesBox();
[7062]78
[6438]79private:
[6441]80  unsigned int             resX;
81  unsigned int             resY;
[3245]82
[10230]83  float                    travelZoneWidth; //the percentage of the screen, the player has got for his movements. should always be a value between 0 and 1;
84
[8145]85  OrxGui::GLGuiWidget*     energyWidget;
86  OrxGui::GLGuiWidget*     shieldWidget;
87  OrxGui::GLGuiWidget*     armorWidget;
[6437]88
[8518]89  OrxGui::GLGuiNotifier*   notifier;
90  OrxGui::GLGuiInputLine*  inputLine;
[8995]91  OrxGui::GLGuiRadar*      _radar;
[8518]92
[10233]93  OrxGui::GLGuiWidget*     rightRect;
94  OrxGui::GLGuiWidget*     leftRect;
95  bool                     overlayActive;
96  int                      overlayPercentage; //the percentage of the screen, the player has got for his movements. should always be a value between 0 and 1;
[10230]97
[6442]98  WeaponManager*           weaponManager;
[9965]99  WeaponManager*           weaponManagerSecondary;
[6442]100
[10230]101  std::list<OrxGui::GLGuiEnergyWidgetVertical*> weaponsWidgetsPrim; //!< WeaponWidgets will be displayed one after another
102  std::list<OrxGui::GLGuiEnergyWidgetVertical*> weaponsWidgetsSec;
[1853]103};
104
[6437]105#endif /* _HUD_H */
Note: See TracBrowser for help on using the repository browser.