OpenMW
|
00001 #include "mapwindow.hpp" 00002 00003 #include "../mwmechanics/stat.hpp" 00004 #include "../mwworld/ptr.hpp" 00005 00006 namespace MWGui 00007 { 00008 class DragAndDrop; 00009 class SpellIcons; 00010 00011 class HUD : public OEngine::GUI::Layout, public LocalMapBase 00012 { 00013 public: 00014 HUD(int width, int height, int fpsLevel, DragAndDrop* dragAndDrop); 00015 virtual ~HUD(); 00016 void setValue (const std::string& id, const MWMechanics::DynamicStat<float>& value); 00017 void setFPS(float fps); 00018 void setTriangleCount(unsigned int count); 00019 void setBatchCount(unsigned int count); 00020 00023 void setDrowningTimeLeft(float time); 00024 void setDrowningBarVisible(bool visible); 00025 00026 void setHmsVisible(bool visible); 00027 void setWeapVisible(bool visible); 00028 void setSpellVisible(bool visible); 00029 void setSneakVisible(bool visible); 00030 00031 void setEffectVisible(bool visible); 00032 void setMinimapVisible(bool visible); 00033 00034 void setFpsLevel(const int level); 00035 00036 void setSelectedSpell(const std::string& spellId, int successChancePercent); 00037 void setSelectedEnchantItem(const MWWorld::Ptr& item, int chargePercent); 00038 void setSelectedWeapon(const MWWorld::Ptr& item, int durabilityPercent); 00039 void unsetSelectedSpell(); 00040 void unsetSelectedWeapon(); 00041 00042 void setCrosshairVisible(bool visible); 00043 00044 void onFrame(float dt); 00045 void onResChange(int width, int height); 00046 00047 void setCellName(const std::string& cellName); 00048 00049 bool getWorldMouseOver() { return mWorldMouseOver; } 00050 00051 MyGUI::Widget* getEffectBox() { return mEffectBox; } 00052 00053 void update(); 00054 00055 void setEnemy(const MWWorld::Ptr& enemy); 00056 00057 private: 00058 MyGUI::ProgressBar *mHealth, *mMagicka, *mStamina, *mEnemyHealth, *mDrowning; 00059 MyGUI::Widget* mHealthFrame; 00060 MyGUI::Widget *mWeapBox, *mSpellBox, *mSneakBox; 00061 MyGUI::ImageBox *mWeapImage, *mSpellImage; 00062 MyGUI::ProgressBar *mWeapStatus, *mSpellStatus; 00063 MyGUI::Widget *mEffectBox, *mMinimapBox; 00064 MyGUI::Button* mMinimapButton; 00065 MyGUI::ScrollView* mMinimap; 00066 MyGUI::ImageBox* mCompass; 00067 MyGUI::ImageBox* mCrosshair; 00068 MyGUI::TextBox* mCellNameBox; 00069 MyGUI::TextBox* mWeaponSpellBox; 00070 MyGUI::Widget *mDrowningFrame, *mDrowningFlash; 00071 00072 MyGUI::Widget* mDummy; 00073 00074 MyGUI::Widget* mFpsBox; 00075 MyGUI::TextBox* mFpsCounter; 00076 MyGUI::TextBox* mTriangleCounter; 00077 MyGUI::TextBox* mBatchCounter; 00078 00079 // bottom left elements 00080 int mHealthManaStaminaBaseLeft, mWeapBoxBaseLeft, mSpellBoxBaseLeft, mSneakBoxBaseLeft; 00081 // bottom right elements 00082 int mMinimapBoxBaseRight, mEffectBoxBaseRight; 00083 00084 DragAndDrop* mDragAndDrop; 00085 00086 std::string mCellName; 00087 float mCellNameTimer; 00088 00089 std::string mWeaponName; 00090 std::string mSpellName; 00091 float mWeaponSpellTimer; 00092 00093 bool mMapVisible; 00094 bool mWeaponVisible; 00095 bool mSpellVisible; 00096 00097 bool mWorldMouseOver; 00098 00099 SpellIcons* mSpellIcons; 00100 00101 MWWorld::Ptr mEnemy; 00102 float mEnemyHealthTimer; 00103 00104 bool mIsDrowning; 00105 float mDrowningFlashTheta; 00106 00107 void onWorldClicked(MyGUI::Widget* _sender); 00108 void onWorldMouseOver(MyGUI::Widget* _sender, int x, int y); 00109 void onWorldMouseLostFocus(MyGUI::Widget* _sender, MyGUI::Widget* _new); 00110 void onHMSClicked(MyGUI::Widget* _sender); 00111 void onWeaponClicked(MyGUI::Widget* _sender); 00112 void onMagicClicked(MyGUI::Widget* _sender); 00113 void onMapClicked(MyGUI::Widget* _sender); 00114 00115 void updatePositions(); 00116 }; 00117 }