[10721] | 1 | |
---|
[10688] | 2 | /* |
---|
| 3 | * ORXONOX - the hottest 3D action shooter ever to exist |
---|
| 4 | * > www.orxonox.net < |
---|
| 5 | * |
---|
| 6 | * |
---|
| 7 | * License notice: |
---|
| 8 | * |
---|
| 9 | * This program is free software; you can redistribute it and/or |
---|
| 10 | * modify it under the terms of the GNU General Public License |
---|
| 11 | * as published by the Free Software Foundation; either version 2 |
---|
| 12 | * of the License, or (at your option) any later version. |
---|
| 13 | * |
---|
| 14 | * This program is distributed in the hope that it will be useful, |
---|
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 17 | * GNU General Public License for more details. |
---|
| 18 | * |
---|
| 19 | * You should have received a copy of the GNU General Public License |
---|
| 20 | * along with this program; if not, write to the Free Software |
---|
| 21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
| 22 | * |
---|
| 23 | * Author: |
---|
| 24 | * Fabien Vultier |
---|
| 25 | * Co-authors: |
---|
| 26 | * ... |
---|
| 27 | * |
---|
| 28 | */ |
---|
| 29 | |
---|
| 30 | #ifndef _HUDWeaponMode_H__ |
---|
| 31 | #define _HUDWeaponMode_H__ |
---|
| 32 | |
---|
| 33 | #include "overlays/OverlaysPrereqs.h" |
---|
| 34 | |
---|
| 35 | #include <map> |
---|
| 36 | #include <vector> |
---|
| 37 | #include <string> |
---|
| 38 | |
---|
| 39 | #include <OgreOverlayManager.h> |
---|
| 40 | #include <OgrePanelOverlayElement.h> |
---|
| 41 | |
---|
| 42 | #include "overlays/OrxonoxOverlay.h" |
---|
| 43 | #include "overlays/OverlayText.h" |
---|
| 44 | #include "tools/interfaces/Tickable.h" |
---|
| 45 | #include "worldentities/pawns/Pawn.h" |
---|
| 46 | #include "overlays/OverlayGroup.h" |
---|
| 47 | #include "weaponsystem/ReplenishingMunition.h" |
---|
[10724] | 48 | #include "weaponsystem/WeaponMode.h" |
---|
| 49 | #include "weaponsystem/Munition.h" |
---|
[10688] | 50 | |
---|
| 51 | namespace orxonox |
---|
| 52 | { |
---|
| 53 | class _OverlaysExport HUDWeaponMode : public OrxonoxOverlay, public Tickable |
---|
| 54 | { |
---|
| 55 | public: |
---|
| 56 | HUDWeaponMode(Context* context); |
---|
| 57 | virtual ~HUDWeaponMode(); |
---|
| 58 | |
---|
[11071] | 59 | virtual void tick(float dt) override; |
---|
| 60 | virtual void changedOwner() override; |
---|
| 61 | virtual void changedOverlayGroup() override; |
---|
| 62 | virtual void changedVisibility() override; |
---|
| 63 | virtual void changedName() override; |
---|
| 64 | virtual void positionChanged() override; |
---|
| 65 | virtual void sizeChanged() override; |
---|
[10688] | 66 | |
---|
[11071] | 67 | void setWeaponMode(WeaponMode* weaponMode); |
---|
[10688] | 68 | |
---|
[10721] | 69 | inline void setWeaponModeHUDActualSize(Vector2 vector) |
---|
| 70 | { weaponModeHUDActualSize_ = vector; |
---|
| 71 | this->updateSize(); |
---|
| 72 | } |
---|
| 73 | inline Vector2 getWeaponModeHUDActualSize() const |
---|
| 74 | { return weaponModeHUDActualSize_; } |
---|
| 75 | inline void setWeaponIndex(int index) |
---|
| 76 | { weaponIndex_ = index; |
---|
| 77 | this->updatePosition(); |
---|
| 78 | } |
---|
| 79 | inline void setWeaponModeIndex(int index) |
---|
| 80 | { weaponModeIndex_ = index; |
---|
| 81 | this->updatePosition(); |
---|
| 82 | } |
---|
[10739] | 83 | inline void setPositionOffset(Vector2 positionOffset) |
---|
| 84 | { |
---|
| 85 | this->positionOffset_ = positionOffset; |
---|
| 86 | this->updatePosition(); |
---|
| 87 | } |
---|
[10721] | 88 | |
---|
| 89 | private: |
---|
[11071] | 90 | void updateSize(); |
---|
| 91 | void updatePosition(); |
---|
| 92 | void positionHUDChilds(); |
---|
[10721] | 93 | |
---|
[10688] | 94 | WeakPtr<Pawn> owner_; |
---|
| 95 | WeakPtr<WeaponMode> weaponMode_; |
---|
| 96 | |
---|
| 97 | Ogre::PanelOverlayElement* overlayElementIcon_; |
---|
| 98 | Ogre::PanelOverlayElement* overlayElementReplenish_; |
---|
| 99 | Ogre::PanelOverlayElement* overlayElementMunition_; |
---|
| 100 | Ogre::PanelOverlayElement* overlayElementState_; |
---|
| 101 | |
---|
| 102 | std::string materialNameState_; |
---|
| 103 | |
---|
| 104 | StrongPtr<OverlayText> textOverlayLeft_; |
---|
| 105 | StrongPtr<OverlayText> textOverlayRight_; |
---|
[10721] | 106 | |
---|
| 107 | Vector2 weaponModeHUDActualSize_; |
---|
[10739] | 108 | Vector2 positionOffset_; |
---|
[10721] | 109 | int weaponIndex_; |
---|
| 110 | int weaponModeIndex_; |
---|
[10688] | 111 | }; |
---|
| 112 | } |
---|
| 113 | |
---|
| 114 | #endif /* _HUDWeaponMode_H__ */ |
---|