Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/hud/src/orxonox/hud/HUD.h @ 1588

Last change on this file since 1588 was 1588, checked in by rgrieder, 16 years ago
  • added XML loadable HUD
  • Radar and navi are not yet done
  • explanations follow with when things are finished
  • Property svn:eol-style set to native
File size: 2.7 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 *      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
42namespace orxonox
43{
44    class HUDBar;
45    class HUDOverlay;
46
47    class _OrxonoxExport HUD : public BaseObject, public TickableReal
48    {
49      public:
50        HUD();
51        ~HUD();
52
53        virtual void XMLPort(Element& xmlElement, XMLPort::Mode mode);
54
55        virtual void tick(float);
56
57        void resize();
58        void addRadarObject(WorldEntity* object, const ColourValue& colour = ColourValue(0.5, 0.5, 0.5, 1));
59        void removeRadarObject(WorldEntity* object);
60        void setFPS();
61
62        inline std::list<RadarObject*>& getRadarObjects()
63            { return this->roSet_; }
64
65        static HUD& getSingleton();
66
67        static void setEnergy(float value);
68        static void cycleNavigationFocus();
69        static void releaseNavigationFocus();
70        static void toggleVisibility(const std::string& name);
71
72      private:
73        HUD(const HUD& instance);
74
75        void addHUDElement(HUDOverlay* element);
76        HUDOverlay* getHUDElement(unsigned int index);
77
78        std::map<std::string, HUDOverlay*> hudElements_;
79
80        std::list<RadarObject*> roSet_;
81
82        RadarOverlayElementFactory radarOverlayElementFactory_;
83
84        Ogre::Overlay* orxonoxHUD_;
85        Ogre::OverlayContainer* container_;
86        Ogre::TextAreaOverlayElement* fpsText_;
87        Ogre::TextAreaOverlayElement* rTRText_;
88        HUDBar* energyBar_;
89        BarOverlayElement* speedoBar_;
90        RadarOverlayElement* radar_;
91        Navigation* nav_;
92
93        bool showFPS_;
94        bool showRenderTime_;
95
96        static HUD* instance_s;
97    };
98}
99
100#endif /* _HUD_H__ */
Note: See TracBrowser for help on using the repository browser.