1 /* This file is part of sparrow3d.
2 * Sparrow3d is free software: you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation, either version 2 of the License, or
5 * (at your option) any later version.
7 * Sparrow3d is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with Foobar. If not, see <http://www.gnu.org/licenses/>
15 * For feedback and questions about my Files and Projects please mail me,
16 * Alexander Matthes (Ziz) , zizsdl_at_googlemail.com */
18 /* Title: sparrowDefines
20 * SparrowDefines contains many #defines used by the library or which
21 * may be usefull for your application */
23 #ifndef _SPARROW_DEFINES_H
24 #define _SPARROW_DEFINES_H
26 /* These are defines for creating or using the library in C or C++ */
30 # define DLLIMPORT __declspec (dllexport)
31 #else /* Not BUILDING_DLL */
32 # define DLLIMPORT __declspec (dllimport)
33 #endif /* Not BUILDING_DLL */
35 #define PREFIX extern "C" DLLIMPORT
37 #define PREFIX DLLIMPORT
41 #define PREFIX extern "C"
47 /* Defines: Fixed Point Arithmetic Constants
49 * The following #defines are for the fixed point arithmetic in
50 * sparrow3d. Change the values only, if you know, what you are doing.
51 * There should be optimal already.
53 * SP_ACCURACY - Defines how many bits are used for the decimal place
54 * SP_HALF_ACCURACY - The half of <SP_ACCURACY>
55 * SP_ACCURACY_FACTOR - 2 ^ <SP_ACCURACY>. Needed for float conversation
56 * SP_SQRT_ACCURACY - Accurary of the internal sqrt lookuptable
57 * SP_PI - Fixed point Pi
58 * SP_MATH_ACCURACY - (In)accuracy of the cos and sin lookup table
59 * SP_ONE - 1.0f in fixed point*/
61 #define SP_ACCURACY 16
62 #define SP_HALF_ACCURACY 8
63 #define SP_ACCURACY_FACTOR 65536.0f
64 #define SP_SQRT_ACCURACY 16
66 /* This is not really accuracy... More inaccuracy ^^ */
67 #define SP_MATH_ACCURACY 4
68 /* a fast define for the fixed point value 1.0 */
71 /* Defines: Fixed Point Arithmetics
73 * These are some #defines for fast multiplication and division of
74 * fixed point numbers. Use them like normal functions, e.g.
75 * Sint32 a = spMul(b,c); instead of a = b * c (which will not work).
76 * However multiplying a fixed point number with a "normal" integer just works
77 * with the normal multiplication. For addition you have to convert!
79 * spMul(a,b) - Multiplies fixed point number a with the fixed point number b
80 * spMulHigh(a,b) - Does the same as <spMul(a,b)>, but with guaranteed high precision
81 * spMulLow(a,b) - Does the same as <spMul(a,b)>, but maybe with lower precision
82 * spDiv(a,b) - Divides fixed point number a with the fixed point number b
83 * spDivHigh(a,b) - Does the same as <spDiv(a,b)>, but with guaranteed high precision
84 * spDivLow(a,b) - Does the same as <spDiv(a,b)>, but maybe with lower precision
85 * spSquare(a) - Squares the fixed point number a with the help of <spMul(a,b)>. */
86 #define spMulHigh(a,b) ((Sint64)(a)*(Sint64)(b)>>SP_ACCURACY)
87 #define spMulLow(a,b) (((a)>>SP_HALF_ACCURACY)*((b)>>SP_HALF_ACCURACY))
89 #ifdef FAST_MULTIPLICATION
90 #define spMul(a,b) spMulLow(a,b)
92 #define spMul(a,b) spMulHigh(a,b)
95 #define spSquare(a) spMul(a,a)
97 #define spDivHigh(a,b) (((Sint64)(a)<<SP_ACCURACY)/(Sint64)(b))
98 /*#define spDivLow(a,b) ((b>=0 && b<(1<<SP_ACCURACY))? \
99 (a*spGetOne_over_x_pointer()[b]): \
101 (b <0 && b>(-1<<SP_ACCURACY))? \
102 (-a*spGetOne_over_x_pointer()[-b]): \
103 (((a<<SP_HALF_ACCURACY)/b)<<SP_HALF_ACCURACY) \
105 #define spDivLow(a,b) (((a<<SP_HALF_ACCURACY)/b)<<SP_HALF_ACCURACY)
107 #define spDiv(a,b) spDivLow(a,b)
109 #define spDiv(a,b) spDivHigh(a,b)
112 /* Defines: Fixed Point Conversion
114 * These conversions are no function calls, but defines. That means *before* the
115 * compiler compiles the code, it is replaced by the defined rule. E.g., you
116 * want to convert the float a to a fixed point number using spFloatToFixed. You
118 * > Sint32 foo = spFloatToFixed(bar);
119 * Internal the compiler will make this:
120 * > Sint32 foo = ((Sint32)((float)(bar)*SP_ACCURACY_FACTOR));
121 * This saves you a function call. But it gets MUCH cheaper, if you don't have
122 * a float variable as parameter, but a number like 1.5f. Example:
123 * > Sint32 foo = spFloatToFixed(1.5);
125 * > Sint32 foo = ((Sint32)((float)(1.5f)*SP_ACCURACY_FACTOR));
126 * As no unknown parameter is in this equation the compiler will calculate it
127 * at *compile time*, which means: In you final binary, the (binary) code will
129 * > Sint32 foo = 98304;
130 * which is obviouly *incredible* fast.
132 * spFixedToFloat(x) - converts the fixed point number a to a float
133 * spFloatToFixed(x) - converts the float a to a fixed point number
134 * spIntToFixed(x) - converts the int x to a fixed point number
135 * spFixedToInt(x) - converts the fixed point number x to an int with cutting of
137 * spFixedRoundInt(x) - converts the fixed point number x with round to an int */
139 #define spFixedToFloat(x) ((float)(x)/SP_ACCURACY_FACTOR)
140 #define spFloatToFixed(x) ((Sint32)((float)(x)*SP_ACCURACY_FACTOR))
141 #define spIntToFixed(x) ((Sint32)(((int)(x))<<SP_ACCURACY))
142 #define spFixedToInt(x) ((int)(((Sint32)(x))>>SP_ACCURACY))
144 #define spFixedRoundInt(x) ((int)(((Sint32)(x)+(1 << SP_ACCURACY-1))>>SP_ACCURACY))
146 /* Defines: Generic Buttons
148 * The following (long) list of #defines gives you the numbers and names
149 * of the generic device buttons or of the buttons on the explicit
150 * device. The Dingoo e.g. has the A button on the right, but GP2X and
151 * others on the left. That means: If you want the button with the
152 * CAPTION "A" use SP_BUTTON_A, but if you want the LEFT Button on every
153 * device use SP_BUTTON_LEFT, which will be SP_BUTTON_A on the gp2x or
154 * SP_BUTTON_Y on the Dingoo. The same for the names. Buttons like
155 * SP_BUTTON_L or similar are defined just one time - because they are
156 * the same on every device.
158 * SP_BUTTON_START - number of the "Start" or "Menu" button
159 * SP_BUTTON_SELECT - number of the "Select", "||" or similar button
160 * SP_BUTTON_L - number of the left shoulder button
161 * SP_BUTTON_R - number of the right shoulder button
162 * SP_BUTTON_A - number of the A button. On every device at another position!
163 * SP_BUTTON_B - number of the B button. On every device at another position!
164 * SP_BUTTON_X - number of the X button. On every device at another position!
165 * SP_BUTTON_Y - number of the Y button. On every device at another position!
166 * SP_BUTTON_LEFT - number of the left button. On every device at the same position!
167 * SP_BUTTON_RIGHT - number of the right button. On every device at the same position!
168 * SP_BUTTON_UP - number of the up button. On every device at the same position!
169 * SP_BUTTON_DOWN - number of the down button. On every device at the same position!
170 * SP_PRACTICE_OK - number of the button, which is on the specific device the
171 * standard button for "ok".
172 * SP_PRACTICE_CANCEL - number of the button, which is on the specific device
173 * SP_PRACTICE_3 - number of the button, which is on the specific device the
174 * neither ok nor cancel.
175 * SP_PRACTICE_4 - number of the other button, which is on the specific device
176 * neither ok nor cancel. */
178 /* Defines: Generic Buttons Names
180 * SP_BUTTON_START_NAME - name of the "Start" or "Menu" button
181 * SP_BUTTON_SELECT_NAME - name of the "Select", "||" or similar button
182 * SP_BUTTON_L_NAME - name of the left shoulder button
183 * SP_BUTTON_R_NAME - name of the right shoulder button
184 * SP_BUTTON_A_NAME - name of the A button.
185 * SP_BUTTON_B_NAME - name of the B button.
186 * SP_BUTTON_X_NAME - name of the X button.
187 * SP_BUTTON_Y_NAME - name of the Y button.
188 * SP_BUTTON_LEFT_NAME - name of the left button.
189 * SP_BUTTON_RIGHT_NAME - name of the right button.
190 * SP_BUTTON_UP_NAME - name of the up button.
191 * SP_BUTTON_DOWN_NAME - name of the down button.
192 * SP_PAD_NAME - name of the pad (e.g. "Arrows keys" on the PC)
193 * SP_PRACTICE_OK_NAME - name of the button, which is on the specific device the
194 * standard button for "ok".
195 * SP_PRACTICE_CANCEL_NAME - name of the button, which is on the specific device
196 * the standard button for canceling an action.
197 * SP_PRACTICE_3_NAME - name of the button, which is on the specific device the
198 * neither ok nor cancel.
199 * SP_PRACTICE_4_NAME - name of the other button, which is on the specific device
200 * neither ok nor cancel*/
203 #define SP_AXIS_LEFTUP 1
204 #define SP_AXIS_LEFT 2
205 #define SP_AXIS_LEFTDOWN 3
206 #define SP_AXIS_DOWN 4
207 #define SP_AXIS_RIGHTDOWN 5
208 #define SP_AXIS_RIGHT 6
209 #define SP_AXIS_RIGHTUP 7
210 #define SP_BUTTON_START 8
211 #define SP_BUTTON_SELECT 9
212 #define SP_BUTTON_L 10
213 #define SP_BUTTON_R 11
214 #define SP_BUTTON_A 12
215 #define SP_BUTTON_B 13
216 #define SP_BUTTON_X 14
217 #define SP_BUTTON_Y 15
218 #define SP_BUTTON_LEFT SP_BUTTON_A
219 #define SP_BUTTON_UP SP_BUTTON_Y
220 #define SP_BUTTON_RIGHT SP_BUTTON_B
221 #define SP_BUTTON_DOWN SP_BUTTON_X
222 #define SP_BUTTON_GP2X_ONLY_VOLPLUS 16
223 #define SP_BUTTON_GP2X_ONLY_VOLMINUS 17
224 #define SP_BUTTON_GP2X_ONLY_TIP 18
225 //just for different practices
226 #define SP_PRACTICE_OK SP_BUTTON_B
227 #define SP_PRACTICE_CANCEL SP_BUTTON_X
228 #define SP_PRACTICE_3 SP_BUTTON_A
229 #define SP_PRACTICE_4 SP_BUTTON_Y
231 #define SP_BUTTON_A 0
232 #define SP_BUTTON_X 1
233 #define SP_BUTTON_B 2
234 #define SP_BUTTON_Y 3
235 #define SP_BUTTON_LEFT SP_BUTTON_A
236 #define SP_BUTTON_UP SP_BUTTON_Y
237 #define SP_BUTTON_RIGHT SP_BUTTON_B
238 #define SP_BUTTON_DOWN SP_BUTTON_X
239 #define SP_BUTTON_L 4
240 #define SP_BUTTON_R 5
241 #define SP_BUTTON_START 6
243 #define SP_BUTTON_SELECT 8
244 //the Caanoo has a hardware volume control...
245 #define SP_PRACTICE_OK SP_BUTTON_B
246 #define SP_PRACTICE_CANCEL SP_BUTTON_X
247 #define SP_PRACTICE_3 SP_BUTTON_A
248 #define SP_PRACTICE_4 SP_BUTTON_Y
250 #define SP_BUTTON_START 8
251 #define SP_BUTTON_SELECT 9
252 #define SP_BUTTON_L 10
253 #define SP_BUTTON_R 11
254 #define SP_BUTTON_A 12
255 #define SP_BUTTON_B 13
256 #define SP_BUTTON_X 14
257 #define SP_BUTTON_Y 15
258 #define SP_BUTTON_LEFT SP_BUTTON_Y
259 #define SP_BUTTON_UP SP_BUTTON_X
260 #define SP_BUTTON_RIGHT SP_BUTTON_A
261 #define SP_BUTTON_DOWN SP_BUTTON_B
262 #define SP_PRACTICE_OK SP_BUTTON_A
263 #define SP_PRACTICE_CANCEL SP_BUTTON_X
264 #define SP_PRACTICE_3 SP_BUTTON_B
265 #define SP_PRACTICE_4 SP_BUTTON_Y
267 #define SP_BUTTON_START 8
268 #define SP_BUTTON_SELECT 9
269 #define SP_BUTTON_L 10
270 #define SP_BUTTON_R 11
271 #define SP_BUTTON_A 12
272 #define SP_BUTTON_B 13
273 #define SP_BUTTON_X 14
274 #define SP_BUTTON_Y 15
275 #define SP_BUTTON_LEFT SP_BUTTON_X
276 #define SP_BUTTON_UP SP_BUTTON_Y
277 #define SP_BUTTON_RIGHT SP_BUTTON_A
278 #define SP_BUTTON_DOWN SP_BUTTON_B
279 #define SP_PRACTICE_OK SP_BUTTON_A
280 #define SP_PRACTICE_CANCEL SP_BUTTON_B
281 #define SP_PRACTICE_3 SP_BUTTON_X
282 #define SP_PRACTICE_4 SP_BUTTON_Y
283 #elif defined PANDORA
284 #define SP_AXIS_LEFTRIGHT 0
285 #define SP_AXIS_UPDOWN 1
286 #define SP_BUTTON_START 8
287 #define SP_BUTTON_SELECT 9
288 #define SP_BUTTON_L 10
289 #define SP_BUTTON_R 11
290 #define SP_BUTTON_A 12
291 #define SP_BUTTON_B 13
292 #define SP_BUTTON_X 14
293 #define SP_BUTTON_Y 15
294 #define SP_BUTTON_LEFT SP_BUTTON_A
295 #define SP_BUTTON_UP SP_BUTTON_Y
296 #define SP_BUTTON_RIGHT SP_BUTTON_B
297 #define SP_BUTTON_DOWN SP_BUTTON_X
298 #define SP_PRACTICE_OK SP_BUTTON_A
299 #define SP_PRACTICE_CANCEL SP_BUTTON_X
300 #define SP_PRACTICE_3 SP_BUTTON_B
301 #define SP_PRACTICE_4 SP_BUTTON_Y
303 #define SP_AXIS_LEFTRIGHT 0
304 #define SP_AXIS_UPDOWN 1
305 #define SP_BUTTON_SELECT_NOWASD 1
306 #define SP_BUTTON_L_NOWASD 2
307 #define SP_BUTTON_R_NOWASD 3
308 #define SP_BUTTON_A_NOWASD 4
309 #define SP_BUTTON_B_NOWASD 5
310 #define SP_BUTTON_X_NOWASD 6
311 #define SP_BUTTON_Y_NOWASD 7
312 #define SP_BUTTON_START 8
313 #define SP_BUTTON_SELECT 9
314 #define SP_BUTTON_L 10
315 #define SP_BUTTON_R 11
316 #define SP_BUTTON_A 12
317 #define SP_BUTTON_B 13
318 #define SP_BUTTON_X 14
319 #define SP_BUTTON_Y 15
320 #define SP_BUTTON_LEFT SP_BUTTON_A
321 #define SP_BUTTON_UP SP_BUTTON_Y
322 #define SP_BUTTON_RIGHT SP_BUTTON_B
323 #define SP_BUTTON_DOWN SP_BUTTON_X
324 #define SP_BUTTON_LEFT_NOWASD SP_BUTTON_A_NOWASD
325 #define SP_BUTTON_UP_NOWASD SP_BUTTON_Y_NOWASD
326 #define SP_BUTTON_RIGHT_NOWASD SP_BUTTON_B_NOWASD
327 #define SP_BUTTON_DOWN_NOWASD SP_BUTTON_X_NOWASD
328 #define SP_PRACTICE_OK SP_BUTTON_A
329 #define SP_PRACTICE_CANCEL SP_BUTTON_B
330 #define SP_PRACTICE_3 SP_BUTTON_X
331 #define SP_PRACTICE_4 SP_BUTTON_Y
332 #define SP_PRACTICE_OK_NOWASD SP_BUTTON_A_NOWASD
333 #define SP_PRACTICE_CANCEL_NOWASD SP_BUTTON_B_NOWASD
334 #define SP_PRACTICE_3_NOWASD SP_BUTTON_X_NOWASD
335 #define SP_PRACTICE_4_NOWASD SP_BUTTON_Y_NOWASD
338 #define SP_BUTTON_START_NOWASD SP_BUTTON_START
340 #define SP_BUTTON_SELECT_NOWASD SP_BUTTON_SELECT
341 #define SP_BUTTON_L_NOWASD SP_BUTTON_L
342 #define SP_BUTTON_R_NOWASD SP_BUTTON_R
343 #define SP_BUTTON_A_NOWASD SP_BUTTON_A
344 #define SP_BUTTON_B_NOWASD SP_BUTTON_B
345 #define SP_BUTTON_X_NOWASD SP_BUTTON_X
346 #define SP_BUTTON_Y_NOWASD SP_BUTTON_Y
347 #define SP_PRACTICE_OK_NOWASD SP_PRACTICE_OK
348 #define SP_PRACTICE_CANCEL_NOWASD SP_PRACTICE_CANCEL
349 #define SP_PRACTICE_3_NOWASD SP_PRACTICE_3
350 #define SP_PRACTICE_4_NOWASD SP_PRACTICE_4
351 #define SP_BUTTON_LEFT_NOWASD SP_BUTTON_LEFT
352 #define SP_BUTTON_UP_NOWASD SP_BUTTON_UP
353 #define SP_BUTTON_RIGHT_NOWASD SP_BUTTON_RIGHT
354 #define SP_BUTTON_DOWN_NOWASD SP_BUTTON_DOWN
358 #define SP_BUTTON_START_NAME "Start"
359 #define SP_BUTTON_SELECT_NAME "Select"
360 #define SP_BUTTON_L_NAME "L"
361 #define SP_BUTTON_R_NAME "R"
362 #define SP_BUTTON_A_NAME "A"
363 #define SP_BUTTON_B_NAME "B"
364 #define SP_BUTTON_X_NAME "X"
365 #define SP_BUTTON_Y_NAME "Y"
366 #define SP_BUTTON_LEFT_NAME SP_BUTTON_A_NAME
367 #define SP_BUTTON_UP_NAME SP_BUTTON_Y_NAME
368 #define SP_BUTTON_RIGHT_NAME SP_BUTTON_B_NAME
369 #define SP_BUTTON_DOWN_NAME SP_BUTTON_X_NAME
370 #define SP_PAD_NAME "D-Pad"
371 #define SP_PRACTICE_OK_NAME SP_BUTTON_B_NAME
372 #define SP_PRACTICE_CANCEL_NAME SP_BUTTON_X_NAME
373 #define SP_PRACTICE_3_NAME SP_BUTTON_A_NAME
374 #define SP_PRACTICE_4_NAME SP_BUTTON_Y_NAME
376 #define SP_BUTTON_START_NAME "Menu"
377 #define SP_BUTTON_SELECT_NAME "Select"
378 #define SP_BUTTON_L_NAME "L"
379 #define SP_BUTTON_R_NAME "R"
380 #define SP_BUTTON_A_NAME "A"
381 #define SP_BUTTON_B_NAME "B"
382 #define SP_BUTTON_X_NAME "X"
383 #define SP_BUTTON_Y_NAME "Y"
384 #define SP_BUTTON_LEFT_NAME SP_BUTTON_A_NAME
385 #define SP_BUTTON_UP_NAME SP_BUTTON_Y_NAME
386 #define SP_BUTTON_RIGHT_NAME SP_BUTTON_B_NAME
387 #define SP_BUTTON_DOWN_NAME SP_BUTTON_X_NAME
388 #define SP_PAD_NAME "D-Pad"
389 #define SP_PRACTICE_OK_NAME SP_BUTTON_B_NAME
390 #define SP_PRACTICE_CANCEL_NAME SP_BUTTON_X_NAME
391 #define SP_PRACTICE_3_NAME SP_BUTTON_A_NAME
392 #define SP_PRACTICE_4_NAME SP_BUTTON_Y_NAME
394 #define SP_BUTTON_START_NAME "Home"
395 #define SP_BUTTON_SELECT_NAME "Help I"
396 #define SP_BUTTON_L_NAME "L"
397 #define SP_BUTTON_R_NAME "R"
398 #define SP_BUTTON_A_NAME "A"
399 #define SP_BUTTON_B_NAME "B"
400 #define SP_BUTTON_X_NAME "X"
401 #define SP_BUTTON_Y_NAME "Y"
402 #define SP_BUTTON_LEFT_NAME SP_BUTTON_A_NAME
403 #define SP_BUTTON_UP_NAME SP_BUTTON_Y_NAME
404 #define SP_BUTTON_RIGHT_NAME SP_BUTTON_B_NAME
405 #define SP_BUTTON_DOWN_NAME SP_BUTTON_X_NAME
406 #define SP_PAD_NAME "Stick"
407 #define SP_PRACTICE_OK_NAME SP_BUTTON_B_NAME
408 #define SP_PRACTICE_CANCEL_NAME SP_BUTTON_X_NAME
409 #define SP_PRACTICE_3_NAME SP_BUTTON_A_NAME
410 #define SP_PRACTICE_4_NAME SP_BUTTON_Y_NAME
412 #define SP_BUTTON_START_NAME "Start"
413 #define SP_BUTTON_SELECT_NAME "Select"
414 #define SP_BUTTON_L_NAME "L"
415 #define SP_BUTTON_R_NAME "R"
416 #define SP_BUTTON_A_NAME "A"
417 #define SP_BUTTON_B_NAME "B"
418 #define SP_BUTTON_X_NAME "X"
419 #define SP_BUTTON_Y_NAME "Y"
420 #define SP_BUTTON_LEFT_NAME SP_BUTTON_Y_NAME
421 #define SP_BUTTON_UP_NAME SP_BUTTON_X_NAME
422 #define SP_BUTTON_RIGHT_NAME SP_BUTTON_A_NAME
423 #define SP_BUTTON_DOWN_NAME SP_BUTTON_B_NAME
424 #define SP_PAD_NAME "D-Pad"
425 #define SP_PRACTICE_OK_NAME SP_BUTTON_A_NAME
426 #define SP_PRACTICE_CANCEL_NAME SP_BUTTON_X_NAME
427 #define SP_PRACTICE_3_NAME SP_BUTTON_B_NAME
428 #define SP_PRACTICE_4_NAME SP_BUTTON_Y_NAME
430 #define SP_BUTTON_START_NAME "Start"
431 #define SP_BUTTON_SELECT_NAME "Select"
432 #define SP_BUTTON_L_NAME "L"
433 #define SP_BUTTON_R_NAME "R"
434 #define SP_BUTTON_A_NAME "A"
435 #define SP_BUTTON_B_NAME "B"
436 #define SP_BUTTON_X_NAME "X"
437 #define SP_BUTTON_Y_NAME "Y"
438 #define SP_BUTTON_LEFT_NAME SP_BUTTON_X_NAME
439 #define SP_BUTTON_UP_NAME SP_BUTTON_Y_NAME
440 #define SP_BUTTON_RIGHT_NAME SP_BUTTON_A_NAME
441 #define SP_BUTTON_DOWN_NAME SP_BUTTON_B_NAME
442 #define SP_PAD_NAME "D-Pad"
443 #define SP_PRACTICE_OK_NAME SP_BUTTON_A_NAME
444 #define SP_PRACTICE_CANCEL_NAME SP_BUTTON_B_NAME
445 #define SP_PRACTICE_3_NAME SP_BUTTON_X_NAME
446 #define SP_PRACTICE_4_NAME SP_BUTTON_Y_NAME
447 #elif defined PANDORA
448 #define SP_BUTTON_START_NAME "Start"
449 #define SP_BUTTON_SELECT_NAME "Select"
450 #define SP_BUTTON_L_NAME "L"
451 #define SP_BUTTON_R_NAME "R"
452 #define SP_BUTTON_A_NAME "A"
453 #define SP_BUTTON_B_NAME "B"
454 #define SP_BUTTON_X_NAME "X"
455 #define SP_BUTTON_Y_NAME "Y"
456 #define SP_BUTTON_LEFT_NAME SP_BUTTON_A_NAME
457 #define SP_BUTTON_UP_NAME SP_BUTTON_Y_NAME
458 #define SP_BUTTON_RIGHT_NAME SP_BUTTON_B_NAME
459 #define SP_BUTTON_DOWN_NAME SP_BUTTON_X_NAME
460 #define SP_PAD_NAME "D-Pad"
461 #define SP_PRACTICE_OK_NAME SP_BUTTON_A_NAME
462 #define SP_PRACTICE_CANCEL_NAME SP_BUTTON_X_NAME
463 #define SP_PRACTICE_3_NAME SP_BUTTON_B_NAME
464 #define SP_PRACTICE_4_NAME SP_BUTTON_Y_NAME
466 #define SP_BUTTON_START_NAME "Return"
467 #define SP_BUTTON_START_NOWASD_NAME "Return"
468 #define SP_BUTTON_SELECT_NAME "Backspace"
469 #define SP_BUTTON_SELECT_NOWASD_NAME "Esc"
470 #define SP_BUTTON_L_NAME "q"
471 #define SP_BUTTON_L_NOWASD_NAME "PgUp"
472 #define SP_BUTTON_R_NAME "e"
473 #define SP_BUTTON_R_NOWASD_NAME "PgDn"
474 #define SP_BUTTON_A_NAME "a"
475 #define SP_BUTTON_A_NOWASD_NAME "Ctrl"
476 #define SP_BUTTON_B_NAME "d"
477 #define SP_BUTTON_B_NOWASD_NAME "Alt"
478 #define SP_BUTTON_X_NAME "s"
479 #define SP_BUTTON_X_NOWASD_NAME "AltGr"
480 #define SP_BUTTON_Y_NAME "w"
481 #define SP_BUTTON_Y_NOWASD_NAME "Shift"
482 #define SP_BUTTON_LEFT_NAME SP_BUTTON_A_NAME
483 #define SP_BUTTON_LEFT_NOWASD_NAME SP_BUTTON_A_NOWASD_NAME
484 #define SP_BUTTON_UP_NAME SP_BUTTON_Y_NAME
485 #define SP_BUTTON_UP_NOWASD_NAME SP_BUTTON_Y_NOWASD_NAME
486 #define SP_BUTTON_RIGHT_NAME SP_BUTTON_B_NAME
487 #define SP_BUTTON_RIGHT_NOWASD_NAME SP_BUTTON_B_NOWASD_NAME
488 #define SP_BUTTON_DOWN_NAME SP_BUTTON_X_NAME
489 #define SP_BUTTON_DOWN_NOWASD_NAME SP_BUTTON_X_NOWASD_NAME
490 #define SP_PAD_NAME "Arrow Keys"
491 #define SP_PRACTICE_OK_NAME SP_BUTTON_A_NAME
492 #define SP_PRACTICE_CANCEL_NAME SP_BUTTON_B_NAME
493 #define SP_PRACTICE_3_NAME SP_BUTTON_X_NAME
494 #define SP_PRACTICE_4_NAME SP_BUTTON_Y_NAME
495 #define SP_PRACTICE_OK_NOWASD_NAME SP_BUTTON_A_NOWASD_NAME
496 #define SP_PRACTICE_CANCEL_NOWASD_NAME SP_BUTTON_B_NOWASD_NAME
497 #define SP_PRACTICE_3_NOWASD_NAME SP_BUTTON_X_NOWASD_NAME
498 #define SP_PRACTICE_4_NOWASD_NAME SP_BUTTON_Y_NOWASD_NAME
502 #define SP_BUTTON_START_NOWASD_NAME SP_BUTTON_START_NAME
503 #define SP_BUTTON_SELECT_NOWASD_NAME SP_BUTTON_SELECT_NAME
504 #define SP_BUTTON_L_NOWASD_NAME SP_BUTTON_L_NAME
505 #define SP_BUTTON_R_NOWASD_NAME SP_BUTTON_R_NAME
506 #define SP_BUTTON_A_NOWASD_NAME SP_BUTTON_A_NAME
507 #define SP_BUTTON_B_NOWASD_NAME SP_BUTTON_B_NAME
508 #define SP_BUTTON_X_NOWASD_NAME SP_BUTTON_X_NAME
509 #define SP_BUTTON_Y_NOWASD_NAME SP_BUTTON_Y_NAME
510 #define SP_PRACTICE_OK_NOWASD_NAME SP_PRACTICE_OK_NAME
511 #define SP_PRACTICE_CANCEL_NOWASD_NAME SP_PRACTICE_CANCEL_NAME
512 #define SP_PRACTICE_3_NOWASD_NAME SP_PRACTICE_3_NAME
513 #define SP_PRACTICE_4_NOWASD_NAME SP_PRACTICE_4_NAME
514 #define SP_BUTTON_LEFT_NOWASD_NAME SP_BUTTON_LEFT_NAME
515 #define SP_BUTTON_UP_NOWASD_NAME SP_BUTTON_UP_NAME
516 #define SP_BUTTON_RIGHT_NOWASD_NAME SP_BUTTON_RIGHT_NAME
517 #define SP_BUTTON_DOWN_NOWASD_NAME SP_BUTTON_DOWN_NAME
520 /* Defines: Generic Buttons Masks
522 * Mask of the buttons, Useful for <spPollKeyboardInput>s last parameter.
524 * SP_BUTTON_START_MASK - mask of the "Start" or "Menu" button
525 * SP_BUTTON_SELECT_MASK - mask of the "Select", "||" or similar button
526 * SP_BUTTON_L_MASK - mask of the left shoulder button
527 * SP_BUTTON_R_MASK - mask of the right shoulder button
528 * SP_BUTTON_A_MASK - mask of the A button.
529 * SP_BUTTON_B_MASK - mask of the B button.
530 * SP_BUTTON_X_MASK - mask of the X button.
531 * SP_BUTTON_Y_MASK - mask of the Y button.
532 * SP_BUTTON_LEFT_MASK - mask of the left button.
533 * SP_BUTTON_RIGHT_MASK - mask of the right button.
534 * SP_BUTTON_UP_MASK - mask of the up button.
535 * SP_BUTTON_DOWN_MASK - mask of the down button.
536 * SP_PRACTICE_OK_MASK - mask of the button, which is on the specific device the
537 * standard button for "ok".
538 * SP_PRACTICE_CANCEL_MASK - mask of the button, which is on the specific device
539 * the standard button for canceling an action.
540 * SP_PRACTICE_3_MASK - mask of the button, which is on the specific device the
541 * neither ok nor cancel.
542 * SP_PRACTICE_4_MASK - mask of the other button, which is on the specific device
543 * neither ok nor cancel. */
545 //Bit masks for every button
546 #define SP_BUTTON_START_MASK (1 << SP_BUTTON_START)
547 #define SP_BUTTON_SELECT_MASK (1 << SP_BUTTON_SELECT)
548 #define SP_BUTTON_L_MASK (1 << SP_BUTTON_L)
549 #define SP_BUTTON_R_MASK (1 << SP_BUTTON_R)
550 #define SP_BUTTON_A_MASK (1 << SP_BUTTON_A)
551 #define SP_BUTTON_B_MASK (1 << SP_BUTTON_B)
552 #define SP_BUTTON_X_MASK (1 << SP_BUTTON_X)
553 #define SP_BUTTON_Y_MASK (1 << SP_BUTTON_Y)
554 #define SP_BUTTON_LEFT_MASK (1 << SP_BUTTON_LEFT)
555 #define SP_BUTTON_UP_MASK (1 << SP_BUTTON_UP)
556 #define SP_BUTTON_RIGHT_MASK (1 << SP_BUTTON_RIGHT)
557 #define SP_BUTTON_DOWN_MASK (1 << SP_BUTTON_DOWN)
558 #define SP_PRACTICE_OK_MASK (1 << SP_PRACTICE_OK)
559 #define SP_PRACTICE_CANCEL_MASK (1 << SP_PRACTICE_CANCEL)
560 #define SP_PRACTICE_3_MASK (1 << SP_PRACTICE_3)
561 #define SP_PRACTICE_4_MASK (1 << SP_PRACTICE_4)
562 #define SP_BUTTON_START_NOWASD_MASK (1 << SP_BUTTON_START_NOWASD)
563 #define SP_BUTTON_SELECT_NOWASD_MASK (1 << SP_BUTTON_SELECT_NOWASD)
564 #define SP_BUTTON_L_NOWASD_MASK (1 << SP_BUTTON_L_NOWASD)
565 #define SP_BUTTON_R_NOWASD_MASK (1 << SP_BUTTON_R_NOWASD)
566 #define SP_BUTTON_A_NOWASD_MASK (1 << SP_BUTTON_A_NOWASD)
567 #define SP_BUTTON_B_NOWASD_MASK (1 << SP_BUTTON_B_NOWASD)
568 #define SP_BUTTON_X_NOWASD_MASK (1 << SP_BUTTON_X_NOWASD)
569 #define SP_BUTTON_Y_NOWASD_MASK (1 << SP_BUTTON_Y_NOWASD)
570 #define SP_BUTTON_LEFT_NOWASD_MASK (1 << SP_BUTTON_LEFT_NOWASD)
571 #define SP_BUTTON_UP_NOWASD_MASK (1 << SP_BUTTON_UP_NOWASD)
572 #define SP_BUTTON_RIGHT_NOWASD_MASK (1 << SP_BUTTON_RIGHT_NOWASD)
573 #define SP_BUTTON_DOWN_NOWASD_MASK (1 << SP_BUTTON_DOWN_NOWASD)
574 #define SP_PRACTICE_OK_NOWASD_MASK (1 << SP_PRACTICE_OK_NOWASD)
575 #define SP_PRACTICE_CANCEL_NOWASD_MASK (1 << SP_PRACTICE_CANCEL_NOWASD)
576 #define SP_PRACTICE_3_NOWASD_MASK (1 << SP_PRACTICE_3_NOWASD)
577 #define SP_PRACTICE_4_NOWASD_MASK (1 << SP_PRACTICE_4_NOWASD)
579 #define SP_BUTTON_GP2X_ONLY_VOLPLUS_MASK (1 << SP_BUTTON_GP2X_ONLY_VOLPLUS)
580 #define SP_BUTTON_GP2X_ONLY_VOLMINUS_MASK (1 << SP_BUTTON_GP2X_ONLY_VOLMINUS)
581 #define SP_BUTTON_GP2X_ONLY_TIP_MASK (1 << SP_BUTTON_GP2X_ONLY_TIP)
584 /* Defines: Directions
586 * These are some #defines e.g. for sparrowPrimitives to determine,
587 * where the base of the drawn primitive is.
594 * SP_FIXED - sets the base to a fixed position*/
602 // Define: SP_NO_TOUCHSCREEN_EMULATION
603 // Used by <spSetTouchscreenEmulationButtons>
604 #define SP_NO_TOUCHSCREEN_EMULATION -1
606 // Define: SP_ALPHA_COLOR
607 // If alphatest is enabled, this (pink) color will not be drawn, it is "transparent".
608 #define SP_ALPHA_COLOR 63519
610 // Define: SP_DEVICE_STRING
611 // Gives you the name of the device, e.g. "GP2X F100" or "Personal Computer"
613 #define SP_DEVICE_STRING "GP2X F100"
615 #define SP_DEVICE_STRING "GP2X Wiz"
617 #define SP_DEVICE_STRING "GP2X Caanoo"
619 #define SP_DEVICE_STRING "Dingoo"
621 #define SP_DEVICE_STRING "GCW Zero"
622 #elif defined PANDORA
623 #define SP_DEVICE_STRING "Open Pandora"
625 #define SP_DEVICE_STRING "Windows PC"
627 #define SP_DEVICE_STRING "Linux PC"