Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/bindermFS16/src/modules/overlays/hud/HUDWeaponMode.h @ 11238

Last change on this file since 11238 was 11071, checked in by landauf, 9 years ago

merged branch cpp11_v3 back to trunk

  • Property svn:eol-style set to native
File size: 3.4 KB
Line 
1
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"
48#include "weaponsystem/WeaponMode.h"
49#include "weaponsystem/Munition.h"
50
51namespace 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) 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;
66
67        void setWeaponMode(WeaponMode* weaponMode);
68
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            }
83        inline void setPositionOffset(Vector2 positionOffset)
84            {
85                this->positionOffset_ = positionOffset;
86                this->updatePosition();
87            }
88
89    private:
90        void updateSize();
91        void updatePosition();
92        void positionHUDChilds();
93
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_;
106
107        Vector2 weaponModeHUDActualSize_;
108        Vector2 positionOffset_;
109        int weaponIndex_;
110        int weaponModeIndex_;
111    };
112}
113
114#endif /* _HUDWeaponMode_H__ */
Note: See TracBrowser for help on using the repository browser.