Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/archive/waypoints/src/modules/overlays/hud/HUDNavigation.h @ 10233

Last change on this file since 10233 was 9219, checked in by scmoritz, 13 years ago

3D arrow added. Spinns around like crazy. the partyarrow needs a fix :)

  • Property svn:eol-style set to native
File size: 3.5 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 *      Felix Schulthess
24 *   Co-authors:
25 *      Reto Grieder
26 *      Matthias Spalinger
27 *
28 */
29
30#ifndef _HUDNavigation_H__
31#define _HUDNavigation_H__
32
33#include "overlays/OverlaysPrereqs.h"
34
35#include <map>
36#include <string>
37
38
39#include "util/OgreForwardRefs.h"
40#include "tools/interfaces/Tickable.h"
41#include "interfaces/RadarListener.h"
42#include "overlays/OrxonoxOverlay.h"
43
44
45namespace orxonox
46{
47class _OverlaysExport HUDNavigation : public OrxonoxOverlay, public Tickable, public RadarListener
48{
49public:
50    HUDNavigation ( BaseObject* creator );
51    virtual ~HUDNavigation();
52
53    void setConfigValues();
54
55
56
57    virtual void XMLPort ( Element& xmlelement, XMLPort::Mode mode );
58    virtual void tick ( float dt );
59
60    // RadarListener interface
61    virtual void addObject ( RadarViewable* object );
62    virtual void removeObject ( RadarViewable* viewable );
63    virtual void objectChanged ( RadarViewable* viewable );
64
65    virtual void changedOwner();
66    virtual void sizeChanged();
67    virtual void angleChanged() { }
68    virtual void positionChanged() { }
69    virtual void radarTick ( float dt ) {}
70
71    inline float getRadarSensitivity() const
72    { return 1.0f; }
73
74    unsigned int getMarkerLimit() { return this->markerLimit_; }
75
76private:
77    struct ObjectInfo
78    {
79        Ogre::PanelOverlayElement* panel_;
80        Ogre::TextAreaOverlayElement* text_;
81        bool outOfView_;
82        bool wasOutOfView_;
83
84    };
85
86    void showArrow3D();
87    void hideArrow3D();
88
89    orxonox::MovableEntity* arrowEntity;
90
91    bool showObject( RadarViewable* rv );
92
93    // XMLPort accessors
94    void setNavMarkerSize ( float size )
95        { navMarkerSize_ = size; this->sizeChanged(); }
96    float getNavMarkerSize() const
97        { return navMarkerSize_; }
98    void setDetectionLimit( float limit ) 
99        { this->detectionLimit_ = limit; } 
100    float getDetectionLimit() const 
101        { return this->detectionLimit_; }
102
103    void setTextSize ( float size );
104    float getTextSize() const;
105
106    void setFont ( const std::string& font );
107    const std::string& getFont() const;
108
109    typedef std::map<RadarViewable*, ObjectInfo > ObjectMap;
110    ObjectMap activeObjectList_;
111
112    typedef std::list < std::pair<RadarViewable*, unsigned int > > sortedList;
113    sortedList sortedObjectList_;
114
115    float getArrowSizeX(int dist);   
116    float getArrowSizeY(int dist);
117
118    float navMarkerSize_;
119    std::string fontName_;
120    float textSize_;
121    bool showDistance;
122
123    unsigned int markerLimit_;
124    float detectionLimit_; //!< Objects that are more far away than detectionLimit_ are not displayed on the HUD. 10000.0f is the default value.
125
126};
127}
128
129#endif /* _HUDNavigation_H__ */
Note: See TracBrowser for help on using the repository browser.