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 | * Yuning Chai |
---|
24 | * Co-authors: |
---|
25 | * Felix Schulthess |
---|
26 | * |
---|
27 | */ |
---|
28 | |
---|
29 | |
---|
30 | #ifndef _HUD_H__ |
---|
31 | #define _HUD_H__ |
---|
32 | |
---|
33 | #include "OrxonoxPrereqs.h" |
---|
34 | |
---|
35 | #include <OgrePrerequisites.h> |
---|
36 | #include <OgreTextAreaOverlayElement.h> |
---|
37 | #include "core/BaseObject.h" |
---|
38 | #include "objects/Tickable.h" |
---|
39 | #include "util/Math.h" |
---|
40 | #include "OverlayElementFactories.h" |
---|
41 | #include "tools/WindowEventListener.h" |
---|
42 | |
---|
43 | namespace orxonox |
---|
44 | { |
---|
45 | class HUDBar; |
---|
46 | class HUDOverlay; |
---|
47 | |
---|
48 | class _OrxonoxExport HUD : public BaseObject, public TickableReal, public WindowEventListener |
---|
49 | { |
---|
50 | public: |
---|
51 | HUD(); |
---|
52 | ~HUD(); |
---|
53 | |
---|
54 | virtual void XMLPort(Element& xmlElement, XMLPort::Mode mode); |
---|
55 | |
---|
56 | virtual void tick(float); |
---|
57 | |
---|
58 | void resize(); |
---|
59 | void addRadarObject(WorldEntity* object, const ColourValue& colour = ColourValue(0.5, 0.5, 0.5, 1)); |
---|
60 | void removeRadarObject(WorldEntity* object); |
---|
61 | void setFPS(); |
---|
62 | |
---|
63 | inline std::list<RadarObject*>& getRadarObjects() |
---|
64 | { return this->roSet_; } |
---|
65 | |
---|
66 | static HUD& getSingleton(); |
---|
67 | |
---|
68 | static void setEnergy(float value); |
---|
69 | static void cycleNavigationFocus(); |
---|
70 | static void releaseNavigationFocus(); |
---|
71 | static void toggleVisibility(const std::string& name); |
---|
72 | |
---|
73 | private: |
---|
74 | HUD(const HUD& instance); |
---|
75 | |
---|
76 | void addHUDElement(HUDOverlay* element); |
---|
77 | HUDOverlay* getHUDElement(unsigned int index); |
---|
78 | |
---|
79 | void windowResized(int newWidth, int newHeight); |
---|
80 | |
---|
81 | std::map<std::string, HUDOverlay*> hudElements_; |
---|
82 | |
---|
83 | std::list<RadarObject*> roSet_; |
---|
84 | |
---|
85 | RadarOverlayElementFactory radarOverlayElementFactory_; |
---|
86 | |
---|
87 | Ogre::Overlay* orxonoxHUD_; |
---|
88 | Ogre::OverlayContainer* container_; |
---|
89 | Ogre::TextAreaOverlayElement* fpsText_; |
---|
90 | Ogre::TextAreaOverlayElement* rTRText_; |
---|
91 | HUDBar* energyBar_; |
---|
92 | BarOverlayElement* speedoBar_; |
---|
93 | RadarOverlayElement* radar_; |
---|
94 | Navigation* nav_; |
---|
95 | |
---|
96 | bool showFPS_; |
---|
97 | bool showRenderTime_; |
---|
98 | |
---|
99 | static HUD* instance_s; |
---|
100 | }; |
---|
101 | } |
---|
102 | |
---|
103 | #endif /* _HUD_H__ */ |
---|