[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 | |
---|
| 59 | virtual void tick(float dt); |
---|
[10721] | 60 | virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); |
---|
[10688] | 61 | virtual void changedOwner(); |
---|
| 62 | virtual void changedOverlayGroup(); |
---|
| 63 | virtual void changedVisibility(); |
---|
| 64 | virtual void changedName(); |
---|
| 65 | virtual void positionChanged(); |
---|
[10721] | 66 | virtual void sizeChanged(); |
---|
[10688] | 67 | |
---|
| 68 | virtual void setWeaponMode(WeaponMode* weaponMode); |
---|
| 69 | |
---|
[10721] | 70 | inline void setWeaponModeHUDActualSize(Vector2 vector) |
---|
| 71 | { weaponModeHUDActualSize_ = vector; |
---|
| 72 | this->updateSize(); |
---|
| 73 | } |
---|
| 74 | inline Vector2 getWeaponModeHUDActualSize() const |
---|
| 75 | { return weaponModeHUDActualSize_; } |
---|
| 76 | inline void setWeaponIndex(int index) |
---|
| 77 | { weaponIndex_ = index; |
---|
| 78 | this->updatePosition(); |
---|
| 79 | } |
---|
| 80 | inline void setWeaponModeIndex(int index) |
---|
| 81 | { weaponModeIndex_ = index; |
---|
| 82 | this->updatePosition(); |
---|
| 83 | } |
---|
[10739] | 84 | inline void setPositionOffset(Vector2 positionOffset) |
---|
| 85 | { |
---|
| 86 | this->positionOffset_ = positionOffset; |
---|
| 87 | this->updatePosition(); |
---|
| 88 | } |
---|
[10721] | 89 | |
---|
| 90 | private: |
---|
| 91 | virtual void updateSize(); |
---|
| 92 | virtual void updatePosition(); |
---|
[10724] | 93 | virtual void positionHUDChilds(); |
---|
[10721] | 94 | |
---|
[10688] | 95 | WeakPtr<Pawn> owner_; |
---|
| 96 | WeakPtr<WeaponMode> weaponMode_; |
---|
| 97 | |
---|
| 98 | Ogre::PanelOverlayElement* overlayElementIcon_; |
---|
| 99 | Ogre::PanelOverlayElement* overlayElementReplenish_; |
---|
| 100 | Ogre::PanelOverlayElement* overlayElementMunition_; |
---|
| 101 | Ogre::PanelOverlayElement* overlayElementState_; |
---|
| 102 | |
---|
| 103 | std::string materialNameState_; |
---|
| 104 | |
---|
| 105 | StrongPtr<OverlayText> textOverlayLeft_; |
---|
| 106 | StrongPtr<OverlayText> textOverlayRight_; |
---|
[10721] | 107 | |
---|
| 108 | Vector2 weaponModeHUDActualSize_; |
---|
[10739] | 109 | Vector2 positionOffset_; |
---|
[10721] | 110 | int weaponIndex_; |
---|
| 111 | int weaponModeIndex_; |
---|
[10688] | 112 | }; |
---|
| 113 | } |
---|
| 114 | |
---|
| 115 | #endif /* _HUDWeaponMode_H__ */ |
---|