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 | * Reto Grieder |
---|
24 | * Co-authors: |
---|
25 | * ... |
---|
26 | * |
---|
27 | */ |
---|
28 | |
---|
29 | #ifndef _RadarViewable_H__ |
---|
30 | #define _RadarViewable_H__ |
---|
31 | |
---|
32 | #include "OrxonoxPrereqs.h" |
---|
33 | |
---|
34 | #include <string> |
---|
35 | #include <cassert> |
---|
36 | |
---|
37 | #include "util/Math.h" |
---|
38 | #include "core/OrxonoxClass.h" |
---|
39 | #include "core/SmartPtr.h" |
---|
40 | |
---|
41 | namespace orxonox |
---|
42 | { |
---|
43 | class BaseObject; |
---|
44 | |
---|
45 | /** |
---|
46 | @brief Interface for receiving window events. |
---|
47 | */ |
---|
48 | class _OrxonoxExport RadarViewable : virtual public OrxonoxClass |
---|
49 | { |
---|
50 | public: |
---|
51 | enum Shape |
---|
52 | { |
---|
53 | Square, |
---|
54 | Dot, |
---|
55 | Triangle |
---|
56 | }; |
---|
57 | |
---|
58 | |
---|
59 | public: |
---|
60 | RadarViewable(BaseObject* creator, const WorldEntity* wePtr); |
---|
61 | virtual ~RadarViewable(); |
---|
62 | |
---|
63 | inline void setRadarObjectCamouflage(float camouflage) |
---|
64 | { |
---|
65 | if( this->radarObjectCamouflage_ != camouflage ) |
---|
66 | { |
---|
67 | this->radarObjectCamouflage_ = camouflage; |
---|
68 | this->settingsChanged(); |
---|
69 | } |
---|
70 | } |
---|
71 | inline float getRadarObjectCamouflage() const |
---|
72 | { return this->radarObjectCamouflage_; } |
---|
73 | |
---|
74 | inline void setRadarObjectColour(const ColourValue& colour) |
---|
75 | { |
---|
76 | if(this->radarObjectColour_ != colour) |
---|
77 | { |
---|
78 | this->radarObjectColour_ = colour; |
---|
79 | this->settingsChanged(); |
---|
80 | } |
---|
81 | } |
---|
82 | inline const ColourValue& getRadarObjectColour() const |
---|
83 | { return this->radarObjectColour_; } |
---|
84 | |
---|
85 | // void setRadarObjectDescription(const std::string& str); |
---|
86 | // inline const std::string& getRadarObjectDescription() const |
---|
87 | // { return this->radarObjectDescription_; } |
---|
88 | |
---|
89 | inline void setRadarVisibility(bool b) |
---|
90 | { |
---|
91 | if(b!=this->bVisibility_) |
---|
92 | { |
---|
93 | this->bVisibility_ = b; |
---|
94 | this->settingsChanged(); |
---|
95 | } |
---|
96 | } |
---|
97 | inline bool getRadarVisibility() const |
---|
98 | { return this->bVisibility_; } |
---|
99 | |
---|
100 | virtual const WorldEntity* getWorldEntity() const{ return this->wePtr_; } |
---|
101 | |
---|
102 | const Vector3& getRVWorldPosition() const; |
---|
103 | Vector3 getRVOrientedVelocity() const; |
---|
104 | |
---|
105 | inline void setRadarObjectShape(Shape shape) |
---|
106 | { |
---|
107 | if( this->radarObjectShape_ != shape ) |
---|
108 | { |
---|
109 | this->radarObjectShape_ = shape; |
---|
110 | this->settingsChanged(); |
---|
111 | } |
---|
112 | } |
---|
113 | inline Shape getRadarObjectShape() const |
---|
114 | { return this->radarObjectShape_; } |
---|
115 | void settingsChanged(); |
---|
116 | |
---|
117 | |
---|
118 | bool isHumanShip_; |
---|
119 | inline const std::string& getUniqueId() |
---|
120 | { |
---|
121 | return this->uniqueId_; |
---|
122 | } |
---|
123 | //friend class Map; |
---|
124 | |
---|
125 | private: |
---|
126 | void validate(const WorldEntity* object) const; |
---|
127 | bool bVisibility_; |
---|
128 | bool bInitialized_; |
---|
129 | //Map |
---|
130 | std::string uniqueId_; |
---|
131 | BaseObject* creator_; |
---|
132 | |
---|
133 | |
---|
134 | //Radar |
---|
135 | const WorldEntity* wePtr_; |
---|
136 | SmartPtr<Radar> radar_; |
---|
137 | float radarObjectCamouflage_; |
---|
138 | Shape radarObjectShape_; |
---|
139 | std::string radarObjectDescription_; |
---|
140 | ColourValue radarObjectColour_; |
---|
141 | |
---|
142 | }; |
---|
143 | } |
---|
144 | |
---|
145 | #endif /* _RadarViewable_H__ */ |
---|