Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/cegui0.8_ogre1.9/src/modules/overlays/hud/HUDWeapon.h @ 12068

Last change on this file since 12068 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.1 KB
Line 
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
32#include "overlays/OverlaysPrereqs.h"
33
34#include <map>
35#include <vector>
36#include <string>
37
38#include "overlays/OrxonoxOverlay.h"
39#include "tools/interfaces/Tickable.h"
40#include "worldentities/pawns/Pawn.h"
41#include "overlays/OverlayGroup.h"
42#include "weaponsystem/Weapon.h"
43#include "weaponsystem/WeaponMode.h"
44#include "HUDWeaponMode.h"
45
46namespace orxonox
47{
48    class _OverlaysExport HUDWeapon : public OrxonoxOverlay, public Tickable
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
90        WeakPtr<Pawn> owner_;
91        WeakPtr<Weapon> weapon_;
92
93        std::vector<WeakPtr<HUDWeaponMode>> hudWeaponModes_;
94
95        Ogre::PanelOverlayElement* overlayElement_;
96
97        Vector2 weaponModeHUDActualSize_;
98        Vector2 positionOffset_;
99        int weaponIndex_;
100    };
101}
102
103#endif /* _HUDWeapon_H__ */
Note: See TracBrowser for help on using the repository browser.