|
@@ -53,14 +53,8 @@ typedef enum {
|
53
|
53
|
/*!
|
54
|
54
|
* \brief Basic Interface for System implementations (SDLSystem)
|
55
|
55
|
*/
|
56
|
|
-class System
|
57
|
|
-{
|
|
56
|
+class System {
|
58
|
57
|
public:
|
59
|
|
-
|
60
|
|
- ////////////////////////////////////////////////////////////
|
61
|
|
- // Constructors
|
62
|
|
- ////////////////////////////////////////////////////////////
|
63
|
|
-
|
64
|
58
|
/*!
|
65
|
59
|
* \brief Constructs an object of System
|
66
|
60
|
*/
|
|
@@ -71,11 +65,6 @@ public:
|
71
|
65
|
*/
|
72
|
66
|
virtual ~System();
|
73
|
67
|
|
74
|
|
-
|
75
|
|
- ////////////////////////////////////////////////////////////
|
76
|
|
- // Public Accessors
|
77
|
|
- ////////////////////////////////////////////////////////////
|
78
|
|
-
|
79
|
68
|
/*!
|
80
|
69
|
* \brief Generates a buufered string for the printf call
|
81
|
70
|
* \param string Format string like for printf
|
|
@@ -113,8 +102,7 @@ public:
|
113
|
102
|
* \param size size of buffer
|
114
|
103
|
* \returns < 0 on error, 0 on success
|
115
|
104
|
*/
|
116
|
|
- static int downloadToBuffer(char *urlString,
|
117
|
|
- unsigned char **buffer, unsigned int *size);
|
|
105
|
+ static int downloadToBuffer(char *urlString, unsigned char **buffer, unsigned int *size);
|
118
|
106
|
|
119
|
107
|
/*!
|
120
|
108
|
* \brief Downloads something into a disk file.
|
|
@@ -132,11 +120,6 @@ public:
|
132
|
120
|
*/
|
133
|
121
|
static int createDir(char *path);
|
134
|
122
|
|
135
|
|
-
|
136
|
|
- ////////////////////////////////////////////////////////////
|
137
|
|
- // Public Mutators
|
138
|
|
- ////////////////////////////////////////////////////////////
|
139
|
|
-
|
140
|
123
|
/*!
|
141
|
124
|
* \brief Created a new Command Mode.
|
142
|
125
|
* \param command valid command mode for the resource file, eg "[Engine.OpenGL.Driver]"
|
|
@@ -158,10 +141,8 @@ public:
|
158
|
141
|
*/
|
159
|
142
|
virtual void command(const char *cmd);
|
160
|
143
|
|
161
|
|
-
|
162
|
144
|
virtual void gameFrame() = 0;
|
163
|
145
|
|
164
|
|
-
|
165
|
146
|
virtual void handleMouseMotionEvent(float x, float y) = 0;
|
166
|
147
|
|
167
|
148
|
/*!
|
|
@@ -188,21 +169,15 @@ public:
|
188
|
169
|
* \param key is a valid keyboard code
|
189
|
170
|
* \param mod modifier key
|
190
|
171
|
*/
|
191
|
|
- virtual void handleConsoleKeyPressEvent(unsigned int key,
|
192
|
|
- unsigned int mod) = 0;
|
193
|
|
-
|
|
172
|
+ virtual void handleConsoleKeyPressEvent(unsigned int key, unsigned int mod) = 0;
|
194
|
173
|
|
195
|
174
|
virtual void handleKeyPressEvent(unsigned int key, unsigned int mod) = 0;
|
196
|
175
|
|
197
|
|
-
|
198
|
176
|
virtual void handleKeyReleaseEvent(unsigned int key, unsigned int mod) = 0;
|
199
|
177
|
|
200
|
|
-
|
201
|
178
|
virtual void initGL();
|
202
|
179
|
|
203
|
|
-
|
204
|
|
- virtual void initVideo(unsigned int width, unsigned int height,
|
205
|
|
- bool fullscreen) = 0;
|
|
180
|
+ virtual void initVideo(unsigned int width, unsigned int height, bool fullscreen) = 0;
|
206
|
181
|
|
207
|
182
|
/*!
|
208
|
183
|
* \brief Init the resource vars
|
|
@@ -211,13 +186,10 @@ public:
|
211
|
186
|
*/
|
212
|
187
|
virtual int loadResourceFile(const char *filename);
|
213
|
188
|
|
214
|
|
-
|
215
|
189
|
static void resetTicks();
|
216
|
190
|
|
217
|
|
-
|
218
|
191
|
virtual void resizeGL(unsigned int width, unsigned int height);
|
219
|
192
|
|
220
|
|
-
|
221
|
193
|
virtual void runGame() = 0;
|
222
|
194
|
|
223
|
195
|
/*!
|
|
@@ -227,73 +199,56 @@ public:
|
227
|
199
|
*/
|
228
|
200
|
void setConsoleMode(bool on);
|
229
|
201
|
|
230
|
|
-
|
231
|
202
|
void setDriverGL(const char *driver);
|
232
|
203
|
|
233
|
|
-
|
234
|
204
|
void setFastCardPerformance(bool isFast);
|
235
|
205
|
|
236
|
|
-
|
237
|
206
|
virtual void shutdown(int code) = 0;
|
238
|
207
|
|
239
|
|
-
|
240
|
208
|
virtual void swapBuffersGL() = 0;
|
241
|
209
|
|
242
|
|
-
|
243
|
210
|
virtual void toggleFullscreen() = 0;
|
244
|
211
|
|
245
|
212
|
protected:
|
246
|
|
-
|
247
|
|
- unsigned int m_width; //!< Width of the viewport
|
248
|
|
- unsigned int m_height; //!< Height of the viewport
|
249
|
|
- bool m_fastCard; //!< Assume expensive calls are fine if true
|
250
|
|
- char *m_driver; //!< String for dynamic use of GL library
|
251
|
|
- float m_clipNear; //!< Clip near distance
|
252
|
|
- float m_clipFar; //!< Clip far distance
|
253
|
|
- float m_fovY; //!< Field of vision
|
|
213
|
+ unsigned int m_width; //!< Width of the viewport
|
|
214
|
+ unsigned int m_height; //!< Height of the viewport
|
|
215
|
+ bool m_fastCard; //!< Assume expensive calls are fine if true
|
|
216
|
+ char *m_driver; //!< String for dynamic use of GL library
|
|
217
|
+ float m_clipNear; //!< Clip near distance
|
|
218
|
+ float m_clipFar; //!< Clip far distance
|
|
219
|
+ float m_fovY; //!< Field of vision
|
254
|
220
|
Map<unsigned int, int> mKeyEvents; //!< Single key press event mappings
|
255
|
|
- bool mConsoleMode; //!< Using text (console) event handler?
|
256
|
|
- Vector<const char *> mCmdModes; //!< Dynamic resource command collection
|
257
|
|
- unsigned int mCommandMode; //!< Current resource command mode
|
258
|
|
- unsigned int mConsoleKey; //!< Console toggle event now handled lower
|
259
|
|
-
|
260
|
|
-private:
|
261
|
|
-
|
262
|
|
- ////////////////////////////////////////////////////////////
|
263
|
|
- // Private Accessors
|
264
|
|
- ////////////////////////////////////////////////////////////
|
265
|
|
-
|
266
|
|
-
|
267
|
|
- ////////////////////////////////////////////////////////////
|
268
|
|
- // Private Mutators
|
269
|
|
- ////////////////////////////////////////////////////////////
|
|
221
|
+ bool mConsoleMode; //!< Using text (console) event handler?
|
|
222
|
+ Vector<const char *> mCmdModes; //!< Dynamic resource command collection
|
|
223
|
+ unsigned int mCommandMode; //!< Current resource command mode
|
|
224
|
+ unsigned int mConsoleKey; //!< Console toggle event now handled lower
|
270
|
225
|
};
|
271
|
226
|
|
272
|
227
|
|
273
|
228
|
//! \todo Could make these static methods later, depends on API evolution
|
274
|
229
|
|
275
|
|
- /*!
|
276
|
|
- * \brief Checks if Command matches Symbol.
|
277
|
|
- * Returns the rest of the argument list back in command buffer, if any
|
278
|
|
- * \param symbol command string
|
279
|
|
- * \param command with arguments
|
280
|
|
- * \returns true if command matches symbol
|
281
|
|
- */
|
282
|
|
- bool rc_command(const char *symbol, char *command);
|
|
230
|
+/*!
|
|
231
|
+ * \brief Checks if Command matches Symbol.
|
|
232
|
+ * Returns the rest of the argument list back in command buffer, if any
|
|
233
|
+ * \param symbol command string
|
|
234
|
+ * \param command with arguments
|
|
235
|
+ * \returns true if command matches symbol
|
|
236
|
+ */
|
|
237
|
+bool rc_command(const char *symbol, char *command);
|
283
|
238
|
|
284
|
|
- /*!
|
285
|
|
- * \brief Interpret a string as a bool
|
286
|
|
- * \param buffer "true" or "false"
|
287
|
|
- * \param val is set to boolean interpretation of buffer
|
288
|
|
- * \returns -1 for null string, -2 if string is not "true" or "false"
|
289
|
|
- */
|
290
|
|
- int rc_get_bool(char *buffer, bool *val);
|
|
239
|
+/*!
|
|
240
|
+ * \brief Interpret a string as a bool
|
|
241
|
+ * \param buffer "true" or "false"
|
|
242
|
+ * \param val is set to boolean interpretation of buffer
|
|
243
|
+ * \returns -1 for null string, -2 if string is not "true" or "false"
|
|
244
|
+ */
|
|
245
|
+int rc_get_bool(char *buffer, bool *val);
|
291
|
246
|
|
292
|
|
- /*!
|
293
|
|
- * \brief Sets timer state and returns number of ticks
|
294
|
|
- * \param state 0 - reset, 1 - get number of ticks
|
295
|
|
- * \returns number of ticks
|
296
|
|
- */
|
297
|
|
- unsigned int system_timer(int state);
|
|
247
|
+/*!
|
|
248
|
+ * \brief Sets timer state and returns number of ticks
|
|
249
|
+ * \param state 0 - reset, 1 - get number of ticks
|
|
250
|
+ * \returns number of ticks
|
|
251
|
+ */
|
|
252
|
+unsigned int system_timer(int state);
|
298
|
253
|
|
299
|
254
|
#endif
|