Introduced FileSystem and Out classes
[openstranded.git] / src / type.hh
blobc3231cdc156ac0d60c3f8f4b2877619803c72917
1 /*
2 * This file includes the base class definition for types.
3 * An entity's conduct is very precisely defined by its assigned type.
5 * Copyright (C) 2008 Hermann Walth
7 * This file is part of OpenStranded
9 * OpenStranded is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation, either version 3 of the License, or
12 * (at your option) any later version.
14 * OpenStranded is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with OpenStranded. If not, see <http://www.gnu.org/licenses/>.
23 #ifndef STRANDED_TYPE_HH
24 #define STRANDED_TYPE_HH
26 #include <string>
28 typedef unsigned int ID;
31 /**
32 * Types are the prototypes of the single entities.
33 * There is one type class per kingdom.
34 * The single type instances include the information about the types
35 * as read from the definition files.
37 class Type
39 protected:
40 std::string name;
41 float scaleX, scaleY, scaleZ;
42 uint8_t colorR, colorG, colorB;
43 std::string model;
44 std::string iconPath;
45 float fadingDistance;
46 float alpha;
47 float shine;
49 public:
51 /**
52 * The constructor.
53 * @param name The name of this type (used only in editor)
55 Type (const char *name);
57 /**
58 * The destructor.
60 virtual
61 ~Type () {};
66 // Name
68 /**
69 * Set the type name.
70 * @param name The new name of the type
72 inline void
73 setName (const std::string &name) { this->name = name; }
75 /**
76 * Get the type name.
77 * @return The current name of the type
79 inline std::string
80 getName () { return this->name; }
85 // Model path
88 /**
89 * Set the model.
90 * The model is specified by the path to the model file.
91 * @param path Path to the new model file
93 inline void
94 setModel (const std::string &path) { this->model = path; }
96 /**
97 * Return the path to the current model.
98 * @return Path of the current model file
100 inline std::string
101 getModel () { return this->model; }
106 // Icon path
110 * Set the path to the icon used.
111 * The icon is the little thumbnail in the editor.
112 * @param path Path to the new icon file
114 inline void
115 setIconPath (const std::string &path) { this->iconPath = path; }
118 * Return the current icon path.
119 * @return The path to the current icon file
121 inline std::string
122 getIconPath () { return this->iconPath; }
127 // Scaling values
131 * Set the X scaling value.
132 * The scaling values are divided into their coordinate
133 * components.
134 * @param scaleX The new X scaling value
136 inline void
137 setScaleX (const float scaleX) { this->scaleX = scaleX; }
140 * Get the X scaling value.
141 * @return The current X scaling value
143 inline float
144 getScaleX () { return this->scaleX; }
147 * Set the Y scaling value.
148 * @param scaleY The new Y scaling value
150 inline void
151 setScaleY (const float scaleY) { this->scaleY = scaleY; }
154 * Get the Y scaling value.
155 * @return The current Y scaling value
157 inline float
158 getScaleY () { return this->scaleY; }
161 * Set the Z scaling value.
162 * @param scaleZ The new Z scaling value
164 inline void
165 setScaleZ (const float scaleZ) { this->scaleZ = scaleZ; }
168 * Get the Z scaling value.
169 * @return The current Z scaling value
171 inline float
172 getScaleZ () { return this->scaleZ; }
177 // Color values
181 * Set the red value.
182 * @param colorR The new red value ranging from 0 to 255
184 inline void
185 setColorR (const uint8_t colorR) { this->colorR = colorR; }
188 * Get the red value.
189 * @return The current red value ranging from 0 to 255
191 inline uint8_t
192 getColorR () { return this->colorR; }
195 * Set the green value.
196 * @param colorG The new green value ranging from 0 to 255
198 inline void
199 setColorG (const uint8_t colorG) { this->colorG = colorG; }
202 * Get the green value
203 * @return The current green value ranging from 0 to 255
205 inline uint8_t
206 getColorG () { return this->colorG; }
209 * Set the blue value
210 * @param colorB The new blue value ranging from 0 to 255
212 inline void
213 setColorB (const uint8_t colorB) { this->colorB = colorB; }
216 * Get the blue value
217 * @return The current blue value ranging from 0 to 255
219 inline uint8_t
220 getColorB () { return this->colorB; }
225 // Autofading
229 * Set the Autofading distance.
230 * This is the distance to the player when an object fades out of sight
231 * @param fadingDistance The new Autofading distance
233 inline void
234 setFadingDistance (const float fadingDistance) { this->fadingDistance = fadingDistance; }
237 * Get the Autofading distance
238 * @return The current Autofading distance
240 inline float
241 getFadingDistance () { return this->fadingDistance; }
246 // Alpha
250 * Set the value of transparency (aka alpha channel).
251 * @param alpha The new alpha value ranging from 0.0 (invisible) to 1.0 (opaque)
253 inline void
254 setAlpha (const float alpha) { this->alpha = alpha; }
257 * Returns the transparency value.
258 * @return The current alpha value
260 inline float
261 getAlpha () { return this->alpha; }
266 // Shine effect
270 * Set the shine value of the model
271 * @param shine The new shine value
273 inline void
274 setShine (const float shine) { this->shine = shine; }
277 * Get the shine value of the model
278 * @return The current shine value
280 inline float
281 getShine () { return this->shine; }
284 #endif /* STRANDED_TYPE_HH */