Orxonox  0.0.5 Codename: Arcturus
HUDWeapon.h
Go to the documentation of this file.
1 /*
2  * ORXONOX - the hottest 3D action shooter ever to exist
3  * > www.orxonox.net <
4  *
5  *
6  * License notice:
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21  *
22  * Author:
23  * Fabien Vultier
24  * Co-authors:
25  * ...
26  *
27  */
28 
29 #ifndef _HUDWeapon_H__
30 #define _HUDWeapon_H__
31 
33 
34 #include <map>
35 #include <vector>
36 #include <string>
37 
41 #include "overlays/OverlayGroup.h"
42 #include "weaponsystem/Weapon.h"
44 #include "HUDWeaponMode.h"
45 
46 namespace orxonox
47 {
49  {
50  public:
51  HUDWeapon(Context* context);
52  virtual ~HUDWeapon();
53 
54  virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
55  virtual void tick(float dt) override;
56  virtual void changedOwner() override;
57  virtual void changedOverlayGroup() override;
58  virtual void changedVisibility() override;
59  virtual void changedName() override;
60  virtual void positionChanged() override;
61  virtual void sizeChanged() override;
62 
63  void setWeapon(Weapon* weapon);
64 
65  inline void setWeaponModeHUDActualSize(Vector2 vector)
66  { weaponModeHUDActualSize_ = vector;
67  this->updateSize();
68  }
69  inline Vector2 getWeaponModeHUDActualSize() const
70  { return weaponModeHUDActualSize_; }
71  inline void setPositionOffset(Vector2 positionOffset)
72  {
73  this->positionOffset_ = positionOffset;
74  this->updatePosition();
75  }
76  inline void setWeaponIndex(int index)
77  {
78  weaponIndex_ = index;
79  this->updatePosition();
80  }
81 
82  private:
83  void createHUDChilds();
84  void positionHUDChilds();
85  void destroyHUDChilds();
86  void updateWeaponModeList();
87  void updateSize();
88  void updatePosition();
89 
92 
93  std::vector<WeakPtr<HUDWeaponMode>> hudWeaponModes_;
94 
95  Ogre::PanelOverlayElement* overlayElement_;
96 
98  Vector2 positionOffset_;
100  };
101 }
102 
103 #endif /* _HUDWeapon_H__ */
Declaration of the Tickable interface.
void setWeaponIndex(int index)
Definition: HUDWeapon.h:76
WeakPtr wraps a pointer to an object, which becomes nullptr if the object is deleted.
Definition: CorePrereqs.h:236
Vector2 weaponModeHUDActualSize_
Definition: HUDWeapon.h:97
std::vector< WeakPtr< HUDWeaponMode > > hudWeaponModes_
Definition: HUDWeapon.h:93
xmlelement
Definition: Super.h:519
int weaponIndex_
Definition: HUDWeapon.h:99
Declaration of the OverlayGroup class.
WeakPtr< Pawn > owner_
Definition: HUDWeapon.h:90
#define _OverlaysExport
Definition: OverlaysPrereqs.h:60
Ogre::PanelOverlayElement * overlayElement_
Definition: HUDWeapon.h:95
Die Wagnis Klasse hat die folgenden Aufgaben:
Definition: ApplicationPaths.cc:66
Shared library macros, enums, constants and forward declarations for the overlays module ...
Mode
Definition: CorePrereqs.h:102
A Weapon is a StaticEntity that can be attached to a WeaponSlot.
Definition: Weapon.h:46
Definition: Context.h:45
Base class to display content directly onto the screen.
Definition: OrxonoxOverlay.h:72
Declaration of the OrxonoxOverlay class.
Vector2 positionOffset_
Definition: HUDWeapon.h:98
WeakPtr< Weapon > weapon_
Definition: HUDWeapon.h:91
void setWeaponModeHUDActualSize(Vector2 vector)
Definition: HUDWeapon.h:65
The Tickable interface provides a tick(dt) function, that gets called every frame.
Definition: Tickable.h:52
Vector2 getWeaponModeHUDActualSize() const
Definition: HUDWeapon.h:69
void setPositionOffset(Vector2 positionOffset)
Definition: HUDWeapon.h:71
Definition: HUDWeapon.h:48