Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/fabienHS15/src/modules/overlays/hud/HUDWeaponMode.h @ 10724

Last change on this file since 10724 was 10724, checked in by fvultier, 9 years ago

The weapon system HUD rescales properly if the window size changes.

File size: 3.3 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);
60        virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
61        virtual void changedOwner();
62        virtual void changedOverlayGroup();
63        virtual void changedVisibility();
64        virtual void changedName();
65        virtual void positionChanged();
66        virtual void sizeChanged();
67
68        virtual void setWeaponMode(WeaponMode* weaponMode);
69
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            }
84
85    private:
86        virtual void updateSize();
87        virtual void updatePosition();
88        virtual void positionHUDChilds();
89
90        WeakPtr<Pawn> owner_;
91        WeakPtr<WeaponMode> weaponMode_;
92
93        Ogre::PanelOverlayElement* overlayElementIcon_;
94        Ogre::PanelOverlayElement* overlayElementReplenish_;
95        Ogre::PanelOverlayElement* overlayElementMunition_;
96        Ogre::PanelOverlayElement* overlayElementState_;
97
98        std::string materialNameState_;
99
100        StrongPtr<OverlayText> textOverlayLeft_;
101        StrongPtr<OverlayText> textOverlayRight_;
102
103        Vector2 weaponModeHUDActualSize_;
104        int weaponIndex_;
105        int weaponModeIndex_;
106    };
107}
108
109#endif /* _HUDWeaponMode_H__ */
Note: See TracBrowser for help on using the repository browser.