Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/modules/overlays/hud/HUDWeaponMode.h @ 12377

Last change on this file since 12377 was 11795, checked in by landauf, 7 years ago

merged ogre1.9 (including cegui0.8) into new branch

  • 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 "overlays/OrxonoxOverlay.h"
40#include "overlays/OverlayText.h"
41#include "tools/interfaces/Tickable.h"
42#include "worldentities/pawns/Pawn.h"
43#include "overlays/OverlayGroup.h"
44#include "weaponsystem/ReplenishingMunition.h"
45#include "weaponsystem/WeaponMode.h"
46#include "weaponsystem/Munition.h"
47
48namespace orxonox
49{
50    class _OverlaysExport HUDWeaponMode : public OrxonoxOverlay, public Tickable
51    {
52    public:
53        HUDWeaponMode(Context* context);
54        virtual ~HUDWeaponMode();
55
56        virtual void tick(float dt) override;
57        virtual void changedOwner() override;
58        virtual void changedOverlayGroup() override;
59        virtual void changedVisibility() override;
60        virtual void changedName() override;
61        virtual void positionChanged() override;
62        virtual void sizeChanged() override;
63
64        void setWeaponMode(WeaponMode* weaponMode);
65
66        inline void setWeaponModeHUDActualSize(Vector2 vector)
67            { weaponModeHUDActualSize_ = vector;
68              this->updateSize();
69            }
70        inline Vector2 getWeaponModeHUDActualSize() const
71            { return weaponModeHUDActualSize_; }
72        inline void setWeaponIndex(int index)
73            { weaponIndex_ = index;
74              this->updatePosition();
75            }
76        inline void setWeaponModeIndex(int index)
77            { weaponModeIndex_ = index;
78              this->updatePosition();
79            }
80        inline void setPositionOffset(Vector2 positionOffset)
81            {
82                this->positionOffset_ = positionOffset;
83                this->updatePosition();
84            }
85
86    private:
87        void updateSize();
88        void updatePosition();
89        void positionHUDChilds();
90
91        WeakPtr<Pawn> owner_;
92        WeakPtr<WeaponMode> weaponMode_;
93
94        Ogre::PanelOverlayElement* overlayElementIcon_;
95        Ogre::PanelOverlayElement* overlayElementReplenish_;
96        Ogre::PanelOverlayElement* overlayElementMunition_;
97        Ogre::PanelOverlayElement* overlayElementState_;
98
99        std::string materialNameState_;
100
101        StrongPtr<OverlayText> textOverlayLeft_;
102        StrongPtr<OverlayText> textOverlayRight_;
103
104        Vector2 weaponModeHUDActualSize_;
105        Vector2 positionOffset_;
106        int weaponIndex_;
107        int weaponModeIndex_;
108    };
109}
110
111#endif /* _HUDWeaponMode_H__ */
Note: See TracBrowser for help on using the repository browser.