1 | /* |
---|
2 | * HUDAimAssistant.h |
---|
3 | * |
---|
4 | * Created on: Oct 15, 2012 |
---|
5 | * Author: mottetb |
---|
6 | */ |
---|
7 | |
---|
8 | #ifndef HUDAIMASSISTANT_H_ |
---|
9 | #define HUDAIMASSISTANT_H_ |
---|
10 | |
---|
11 | #include "overlays/OverlaysPrereqs.h" |
---|
12 | |
---|
13 | #include <map> |
---|
14 | #include <string> |
---|
15 | |
---|
16 | #include "util/OgreForwardRefs.h" |
---|
17 | #include "tools/interfaces/Tickable.h" |
---|
18 | #include "interfaces/RadarListener.h" |
---|
19 | #include "overlays/OrxonoxOverlay.h" |
---|
20 | |
---|
21 | namespace orxonox |
---|
22 | { |
---|
23 | |
---|
24 | class HUDAimAssistant : public OrxonoxOverlay, public Tickable, public RadarListener |
---|
25 | { |
---|
26 | public: |
---|
27 | HUDAimAssistant(BaseObject* creator); |
---|
28 | virtual ~HUDAimAssistant(); |
---|
29 | |
---|
30 | void setConfigValues(); |
---|
31 | |
---|
32 | virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); |
---|
33 | virtual void tick(float dt); |
---|
34 | |
---|
35 | // RadarListener interface |
---|
36 | virtual void addObject(RadarViewable* object); |
---|
37 | virtual void removeObject(RadarViewable* viewable); |
---|
38 | virtual void objectChanged(RadarViewable* viewable); |
---|
39 | |
---|
40 | virtual void changedOwner(); |
---|
41 | virtual void sizeChanged(); |
---|
42 | virtual void angleChanged() { } |
---|
43 | virtual void positionChanged() { } |
---|
44 | virtual void radarTick(float dt) {} |
---|
45 | |
---|
46 | inline float getRadarSensitivity() const |
---|
47 | { return 1.0f; } |
---|
48 | |
---|
49 | inline unsigned int getMarkerLimit() const |
---|
50 | { return this->markerLimit_; } |
---|
51 | |
---|
52 | private: |
---|
53 | struct ObjectInfo |
---|
54 | { |
---|
55 | Ogre::PanelOverlayElement* panel_; |
---|
56 | bool outOfView_; |
---|
57 | bool wasOutOfView_; |
---|
58 | }; |
---|
59 | |
---|
60 | bool showObject(RadarViewable* rv); |
---|
61 | |
---|
62 | // XMLPort accessors |
---|
63 | inline void setPointerSize(float size) |
---|
64 | { |
---|
65 | pointerSize_ = size; |
---|
66 | this->sizeChanged(); |
---|
67 | } |
---|
68 | inline float getPointerSize() const |
---|
69 | { return pointerSize_; } |
---|
70 | inline void setDetectionLimit(float limit) |
---|
71 | { this->detectionLimit_ = limit; } |
---|
72 | inline float getDetectionLimit() const |
---|
73 | { return this->detectionLimit_; } |
---|
74 | |
---|
75 | std::map<RadarViewable*, ObjectInfo> activeObjectList_; |
---|
76 | std::list<std::pair<RadarViewable*, unsigned int> > sortedObjectList_; |
---|
77 | |
---|
78 | float pointerSize_; |
---|
79 | unsigned int markerLimit_; |
---|
80 | float detectionLimit_; //!< Objects that are more far away than detectionLimit_ are not displayed on the HUD. 10000.0f is the default value. |
---|
81 | }; |
---|
82 | |
---|
83 | } |
---|
84 | |
---|
85 | #endif /* HUDAIMASSISTANT_H_ */ |
---|