OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
hud.hpp
Go to the documentation of this file.
1 #ifndef OPENMW_GAME_MWGUI_HUD_H
2 #define OPENMW_GAME_MWGUI_HUD_H
3 
4 #include "mapwindow.hpp"
5 
6 #include "../mwmechanics/stat.hpp"
7 
8 namespace MWWorld
9 {
10  class Ptr;
11 }
12 
13 namespace MWGui
14 {
15  class DragAndDrop;
16  class SpellIcons;
17  class ItemWidget;
18 
19  class HUD : public Layout, public LocalMapBase
20  {
21  public:
22  HUD(CustomMarkerCollection& customMarkers, DragAndDrop* dragAndDrop, MWRender::LocalMap* localMapRender);
23  virtual ~HUD();
24  void setValue (const std::string& id, const MWMechanics::DynamicStat<float>& value);
25 
29  void setDrowningTimeLeft(float time, float maxTime);
30  void setDrowningBarVisible(bool visible);
31 
32  void setHmsVisible(bool visible);
33  void setWeapVisible(bool visible);
34  void setSpellVisible(bool visible);
35  void setSneakVisible(bool visible);
36 
37  void setEffectVisible(bool visible);
38  void setMinimapVisible(bool visible);
39 
40  void setSelectedSpell(const std::string& spellId, int successChancePercent);
41  void setSelectedEnchantItem(const MWWorld::Ptr& item, int chargePercent);
42  void setSelectedWeapon(const MWWorld::Ptr& item, int durabilityPercent);
43  void unsetSelectedSpell();
44  void unsetSelectedWeapon();
45 
46  void setCrosshairVisible(bool visible);
47  void setCrosshairOwned(bool owned);
48 
49  void onFrame(float dt);
50 
51  void setCellName(const std::string& cellName);
52 
54 
55  MyGUI::Widget* getEffectBox() { return mEffectBox; }
56 
57  void update();
58 
59  void setEnemy(const MWWorld::Ptr& enemy);
60  void resetEnemy();
61 
62  private:
63  MyGUI::ProgressBar *mHealth, *mMagicka, *mStamina, *mEnemyHealth, *mDrowning;
64  MyGUI::Widget* mHealthFrame;
65  MyGUI::Widget *mWeapBox, *mSpellBox, *mSneakBox;
67  MyGUI::ProgressBar *mWeapStatus, *mSpellStatus;
68  MyGUI::Widget *mEffectBox, *mMinimapBox;
69  MyGUI::Button* mMinimapButton;
70  MyGUI::ScrollView* mMinimap;
71  MyGUI::ImageBox* mCompass;
72  MyGUI::ImageBox* mCrosshair;
73  MyGUI::TextBox* mCellNameBox;
74  MyGUI::TextBox* mWeaponSpellBox;
75  MyGUI::Widget *mDrowningFrame, *mDrowningFlash;
76 
77  // bottom left elements
79  // bottom right elements
81 
83 
84  std::string mCellName;
86 
87  std::string mWeaponName;
88  std::string mSpellName;
90 
94 
96 
98 
101 
104 
105  void onWorldClicked(MyGUI::Widget* _sender);
106  void onWorldMouseOver(MyGUI::Widget* _sender, int x, int y);
107  void onWorldMouseLostFocus(MyGUI::Widget* _sender, MyGUI::Widget* _new);
108  void onHMSClicked(MyGUI::Widget* _sender);
109  void onWeaponClicked(MyGUI::Widget* _sender);
110  void onMagicClicked(MyGUI::Widget* _sender);
111  void onMapClicked(MyGUI::Widget* _sender);
112 
113  // LocalMapBase
114  virtual void customMarkerCreated(MyGUI::Widget* marker);
115  virtual void doorMarkerCreated(MyGUI::Widget* marker);
116 
117  void updateEnemyHealthBar();
118 
119  void updatePositions();
120  };
121 }
122 
123 #endif
std::string mSpellName
Definition: hud.hpp:88
Definition: hud.hpp:19
MyGUI::ImageBox * mCrosshair
Definition: hud.hpp:72
void setDrowningBarVisible(bool visible)
Definition: hud.cpp:223
void unsetSelectedWeapon()
Definition: hud.cpp:463
Definition: mapwindow.hpp:66
void onWorldMouseOver(MyGUI::Widget *_sender, int x, int y)
Definition: hud.cpp:269
Definition: mapwindow.hpp:39
MyGUI::Widget * mDrowningFrame
Definition: hud.hpp:75
void onMagicClicked(MyGUI::Widget *_sender)
Definition: hud.cpp:326
float mEnemyHealthTimer
Definition: hud.hpp:100
DragAndDrop * mDragAndDrop
Definition: hud.hpp:82
SpellIcons * mSpellIcons
Definition: hud.hpp:97
MyGUI::Widget * mWeapBox
Definition: hud.hpp:65
void setHmsVisible(bool visible)
Definition: hud.cpp:508
Definition: spellicons.hpp:54
MyGUI::ProgressBar * mHealth
Definition: hud.hpp:63
void onHMSClicked(MyGUI::Widget *_sender)
Definition: hud.cpp:304
int mMinimapBoxBaseRight
Definition: hud.hpp:80
virtual void doorMarkerCreated(MyGUI::Widget *marker)
Definition: hud.cpp:638
int mSpellBoxBaseLeft
Definition: hud.hpp:78
void setEnemy(const MWWorld::Ptr &enemy)
Definition: hud.cpp:617
void setCellName(const std::string &cellName)
Definition: hud.cpp:338
ItemWidget * mWeapImage
Definition: hud.hpp:66
void setSelectedWeapon(const MWWorld::Ptr &item, int durabilityPercent)
Definition: hud.cpp:425
std::string mWeaponName
Definition: hud.hpp:87
MyGUI::Widget * mHealthFrame
Definition: hud.hpp:64
MyGUI::ProgressBar * mWeapStatus
Definition: hud.hpp:67
MyGUI::Button * mMinimapButton
Definition: hud.hpp:69
int mEffectBoxBaseRight
Definition: hud.hpp:80
void setSneakVisible(bool visible)
Definition: hud.cpp:528
Definition: draganddrop.hpp:17
MyGUI::ScrollView * mMinimap
Definition: hud.hpp:70
void onWeaponClicked(MyGUI::Widget *_sender)
Definition: hud.cpp:314
MyGUI::Widget * mSpellBox
Definition: hud.hpp:65
MyGUI::ProgressBar * mDrowning
Definition: hud.hpp:63
HUD(CustomMarkerCollection &customMarkers, DragAndDrop *dragAndDrop, MWRender::LocalMap *localMapRender)
Definition: hud.cpp:70
void updatePositions()
Definition: hud.cpp:546
MyGUI::Widget * mEffectBox
Definition: hud.hpp:68
int mHealthManaStaminaBaseLeft
Definition: hud.hpp:78
int mWeapBoxBaseLeft
Definition: hud.hpp:78
int mSneakBoxBaseLeft
Definition: hud.hpp:78
void unsetSelectedSpell()
Definition: hud.cpp:446
MyGUI::TextBox * mCellNameBox
Definition: hud.hpp:73
void setSpellVisible(bool visible)
Definition: hud.cpp:522
MyGUI::ProgressBar * mSpellStatus
Definition: hud.hpp:67
Local map rendering.
Definition: localmap.hpp:36
MyGUI::TextBox * mWeaponSpellBox
Definition: hud.hpp:74
void onMapClicked(MyGUI::Widget *_sender)
Definition: hud.cpp:309
void setCrosshairVisible(bool visible)
Definition: hud.cpp:491
virtual void customMarkerCreated(MyGUI::Widget *marker)
Definition: hud.cpp:633
std::string mCellName
Definition: hud.hpp:84
float mCellNameTimer
Definition: hud.hpp:85
void setCrosshairOwned(bool owned)
Definition: hud.cpp:496
void update()
Definition: hud.cpp:601
MyGUI::ProgressBar * mStamina
Definition: hud.hpp:63
void updateEnemyHealthBar()
Definition: hud.cpp:584
virtual ~HUD()
Definition: hud.cpp:171
void setSelectedEnchantItem(const MWWorld::Ptr &item, int chargePercent)
Definition: hud.cpp:405
bool mWeaponVisible
Definition: hud.hpp:92
MyGUI::Widget * mSneakBox
Definition: hud.hpp:65
int mEnemyActorId
Definition: hud.hpp:99
MyGUI::Widget * mMinimapBox
Definition: hud.hpp:68
bool mMapVisible
Definition: hud.hpp:91
Definition: layout.hpp:13
void resetEnemy()
Definition: hud.cpp:627
bool mSpellVisible
Definition: hud.hpp:93
void setSelectedSpell(const std::string &spellId, int successChancePercent)
Definition: hud.cpp:372
float mDrowningFlashTheta
Definition: hud.hpp:103
MyGUI::Widget * getEffectBox()
Definition: hud.hpp:55
MyGUI::Widget * mDrowningFlash
Definition: hud.hpp:75
float mWeaponSpellTimer
Definition: hud.hpp:89
void onFrame(float dt)
Definition: hud.cpp:350
Pointer to a LiveCellRef.
Definition: ptr.hpp:19
void setMinimapVisible(bool visible)
Definition: hud.cpp:540
void setValue(const std::string &id, const MWMechanics::DynamicStat< float > &value)
Definition: hud.cpp:180
MyGUI::ProgressBar * mMagicka
Definition: hud.hpp:63
bool mWorldMouseOver
Definition: hud.hpp:95
bool getWorldMouseOver()
Definition: hud.hpp:53
void onWorldMouseLostFocus(MyGUI::Widget *_sender, MyGUI::Widget *_new)
Definition: hud.cpp:298
void setWeapVisible(bool visible)
Definition: hud.cpp:516
MyGUI::ProgressBar * mEnemyHealth
Definition: hud.hpp:63
bool mIsDrowning
Definition: hud.hpp:102
void setEffectVisible(bool visible)
Definition: hud.cpp:534
void setDrowningTimeLeft(float time, float maxTime)
Definition: hud.cpp:210
ItemWidget * mSpellImage
Definition: hud.hpp:66
A widget that shows an icon for an MWWorld::Ptr.
Definition: itemwidget.hpp:15
void onWorldClicked(MyGUI::Widget *_sender)
Definition: hud.cpp:228
MyGUI::ImageBox * mCompass
Definition: hud.hpp:71