zenilib: zenilib/jni/external/zenilib/zeni_rest/Gamestate.cpp Source File

zenilib 0.5.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Gamestate.cpp
Go to the documentation of this file.
1 /* This file is part of the Zenipex Library (zenilib).
2 * Copyright (C) 2011 Mitchell Keith Bloch (bazald).
3 *
4 * zenilib is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * zenilib is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with zenilib. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18 #include <zeni_rest.h>
19
20 #include <algorithm>
21 #include <cmath>
22
23 #include <Zeni/Define.h>
24
25 #if defined(_DEBUG) && defined(_WINDOWS)
26 #define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)
27 #define new DEBUG_NEW
28 #endif
29
30 namespace Zeni {
31
32 #ifdef ANDROID
33 void Gamestate_Base::on_event(android_app &/*app*/, const AInputEvent &/*event*/) {
34 }
35 #else
36 void Gamestate_Base::on_event(const SDL_Event &event) {
37 switch(event.type) {
38 #if !SDL_VERSION_ATLEAST(2,0,0)
39 case SDL_ACTIVEEVENT:
40 on_active(event.active);
41 break;
42 #endif
43 case SDL_KEYDOWN:
44 case SDL_KEYUP:
45 on_key(event.key);
46 break;
47 case SDL_MOUSEMOTION:
48 on_mouse_motion(event.motion);
49 break;
50 case SDL_MOUSEBUTTONDOWN:
51 case SDL_MOUSEBUTTONUP:
52 on_mouse_button(event.button);
53 break;
54 #if SDL_VERSION_ATLEAST(1,3,0)
55 case SDL_MOUSEWHEEL:
56 on_mouse_wheel(event.wheel);
57 break;
58 #endif
59 case SDL_CONTROLLERAXISMOTION:
60 on_controller_axis(event.caxis);
61 break;
62 case SDL_CONTROLLERBUTTONDOWN:
63 case SDL_CONTROLLERBUTTONUP:
64 on_controller_button(event.cbutton);
65 break;
66 case SDL_CONTROLLERDEVICEADDED:
67 case SDL_CONTROLLERDEVICEREMAPPED:
68 case SDL_CONTROLLERDEVICEREMOVED:
69 on_controller_device(event.cdevice);
70 break;
71 case SDL_QUIT:
72 on_quit(event.quit);
73 break;
74 #if SDL_VERSION_ATLEAST(1,3,0)
75 case SDL_WINDOWEVENT:
76 on_window_event(event.window);
77 break;
78 #endif
79 case SDL_SYSWMEVENT:
80 on_system_wm_event(event.syswm);
81 break;
82 #if !SDL_VERSION_ATLEAST(2,0,0)
83 case SDL_VIDEORESIZE:
84 on_video_resize(event.resize);
85 break;
86 case SDL_VIDEOEXPOSE:
87 on_video_expose(event.expose);
88 break;
89 #endif
90 case SDL_USEREVENT:
91 on_user_event(event.user);
92 break;
93 default:
94 // Impossible
95 break;
96 }
97 }
98
99 void Gamestate_Base::on_key(const SDL_KeyboardEvent &event) {
100 if(event.state == SDL_PRESSED && event.keysym.sym == SDLK_ESCAPE)
101 get_Game().push_Popup_Menu_State();
102 }
103
104 void Gamestate_Base::on_mouse_motion(const SDL_MouseMotionEvent &) {
105 }
106
107 void Gamestate_Base::on_mouse_button(const SDL_MouseButtonEvent &) {
108 }
109
110 #if SDL_VERSION_ATLEAST(1,3,0)
111 void Gamestate_Base::on_mouse_wheel(const SDL_MouseWheelEvent &) {
112 }
113 #endif
114
115 void Gamestate_Base::on_controller_axis(const SDL_ControllerAxisEvent &) {
116 }
117
118 void Gamestate_Base::on_controller_button(const SDL_ControllerButtonEvent &) {
119 }
120
121 void Gamestate_Base::on_controller_device(const SDL_ControllerDeviceEvent &) {
122 }
123
124 void Gamestate_Base::on_quit(const SDL_QuitEvent &) {
125 }
126
127 void Gamestate_Base::on_system_wm_event(const SDL_SysWMEvent &) {
128 }
129
130 #if SDL_VERSION_ATLEAST(2,0,0)
131 void Gamestate_Base::on_window_event(const SDL_WindowEvent &event) {
132 if(event.event == SDL_WINDOWEVENT_RESIZED) {
133 Video::change_resolution(Point2i(event.data1, event.data2));
134 Video::save();
135 return;
136 }
137
138 if(event.event != SDL_WINDOWEVENT_FOCUS_GAINED && event.event != SDL_WINDOWEVENT_FOCUS_LOST)
139 return;
140
141 const bool gain = event.event == SDL_WINDOWEVENT_FOCUS_GAINED;
142 #else
143 void Gamestate_Base::on_active(const SDL_ActiveEvent &event) {
144 if(!(event.state & SDL_APPINPUTFOCUS))
145 return;
146
147 const bool gain = event.gain != 0;
148 #endif
149
150 static Window::Mouse_State mouse_state = Window::MOUSE_NORMAL;
151 Window &wr = get_Window();
152
153 if(gain) {
154 wr.set_mouse_state(mouse_state);
155
156 get_Controllers().enable(true);
157 }
158 else {
159 get_Controllers().enable(false);
160
161 mouse_state = wr.get_mouse_state();
162 wr.set_mouse_state(Window::MOUSE_NORMAL);
163
164 if(m_pausable)
165 get_Game().push_Popup_Pause_State();
166 }
167 }
168
169 #if !SDL_VERSION_ATLEAST(2,0,0)
170 void Gamestate_Base::on_video_resize(const SDL_ResizeEvent &event) {
171 Video::change_resolution(Point2i(event.w, event.h));
172 Video::save();
173 }
174 #endif
175
176 #if !SDL_VERSION_ATLEAST(1,3,0)
177 void Gamestate_Base::on_video_expose(const SDL_ExposeEvent &) {
178 }
179 #endif
180
181 void Gamestate_Base::on_user_event(const SDL_UserEvent &) {
182 }
183
184 char Gamestate_Base::to_char(const SDL_Keysym &ks) {
185 Game &gr = get_Game();
186 const bool mod_caps = (ks.mod & KMOD_CAPS) != 0;
187 const bool mod_shift = gr.get_key_state(SDLK_LSHIFT) || gr.get_key_state(SDLK_RSHIFT);
188
189 if(mod_caps ^ mod_shift)
190 switch(ks.sym) {
191 case SDLK_a: return 'A';
192 case SDLK_b: return 'B';
193 case SDLK_c: return 'C';
194 case SDLK_d: return 'D';
195 case SDLK_e: return 'E';
196 case SDLK_f: return 'F';
197 case SDLK_g: return 'G';
198 case SDLK_h: return 'H';
199 case SDLK_i: return 'I';
200 case SDLK_j: return 'J';
201 case SDLK_k: return 'K';
202 case SDLK_l: return 'L';
203 case SDLK_m: return 'M';
204 case SDLK_n: return 'N';
205 case SDLK_o: return 'O';
206 case SDLK_p: return 'P';
207 case SDLK_q: return 'Q';
208 case SDLK_r: return 'R';
209 case SDLK_s: return 'S';
210 case SDLK_t: return 'T';
211 case SDLK_u: return 'U';
212 case SDLK_v: return 'V';
213 case SDLK_w: return 'W';
214 case SDLK_x: return 'X';
215 case SDLK_y: return 'Y';
216 case SDLK_z: return 'Z';
217 default: break;
218 }
219 else
220 switch(ks.sym) {
221 case SDLK_a: return 'a';
222 case SDLK_b: return 'b';
223 case SDLK_c: return 'c';
224 case SDLK_d: return 'd';
225 case SDLK_e: return 'e';
226 case SDLK_f: return 'f';
227 case SDLK_g: return 'g';
228 case SDLK_h: return 'h';
229 case SDLK_i: return 'i';
230 case SDLK_j: return 'j';
231 case SDLK_k: return 'k';
232 case SDLK_l: return 'l';
233 case SDLK_m: return 'm';
234 case SDLK_n: return 'n';
235 case SDLK_o: return 'o';
236 case SDLK_p: return 'p';
237 case SDLK_q: return 'q';
238 case SDLK_r: return 'r';
239 case SDLK_s: return 's';
240 case SDLK_t: return 't';
241 case SDLK_u: return 'u';
242 case SDLK_v: return 'v';
243 case SDLK_w: return 'w';
244 case SDLK_x: return 'x';
245 case SDLK_y: return 'y';
246 case SDLK_z: return 'z';
247 default: break;
248 }
249
250 if(ks.mod & KMOD_NUM)
251 switch(ks.sym) {
252 #if SDL_VERSION_ATLEAST(2,0,0)
253 case SDLK_KP_0: return '0';
254 case SDLK_KP_1: return '1';
255 case SDLK_KP_2: return '2';
256 case SDLK_KP_3: return '3';
257 case SDLK_KP_4: return '4';
258 case SDLK_KP_5: return '5';
259 case SDLK_KP_6: return '6';
260 case SDLK_KP_7: return '7';
261 case SDLK_KP_8: return '8';
262 case SDLK_KP_9: return '9';
263 #else
264 case SDLK_KP0: return '0';
265 case SDLK_KP1: return '1';
266 case SDLK_KP2: return '2';
267 case SDLK_KP3: return '3';
268 case SDLK_KP4: return '4';
269 case SDLK_KP5: return '5';
270 case SDLK_KP6: return '6';
271 case SDLK_KP7: return '7';
272 case SDLK_KP8: return '8';
273 case SDLK_KP9: return '9';
274 #endif
275 case SDLK_KP_MULTIPLY: return '*';
276 case SDLK_KP_PLUS: return '+';
277 case SDLK_KP_MINUS: return '-';
278 case SDLK_KP_PERIOD: return '.';
279 case SDLK_KP_DIVIDE: return '/';
280 case SDLK_KP_EQUALS: return '=';
281 case SDLK_KP_ENTER: return '\n';
282 default: break;
283 }
284
285 switch(ks.sym) {
286 //case SDLK_BACKSPACE: return '\b';
287 case SDLK_TAB: return '\t';
288 case SDLK_RETURN: return '\n'; // '\r' is less sane, but another possibility
289 //case SDLK_ESCAPE: return 0x1B;
290 case SDLK_SPACE: return ' ';
291 case SDLK_EXCLAIM: return '!';
292 case SDLK_QUOTEDBL: return '"';
293 case SDLK_HASH: return '#';
294 #if SDL_VERSION_ATLEAST(1,3,0)
295 case SDLK_PERCENT: return '%';
296 #endif
297 case SDLK_DOLLAR: return '$';
298 case SDLK_AMPERSAND: return '&';
299 case SDLK_QUOTE: return mod_shift ? '"' : '\'';
300 case SDLK_LEFTPAREN: return '(';
301 case SDLK_RIGHTPAREN: return ')';
302 case SDLK_ASTERISK: return '*';
303 case SDLK_PLUS: return '+';
304 case SDLK_COMMA: return mod_shift ? '<' : ',';
305 case SDLK_MINUS: return mod_shift ? '_' : '-';
306 case SDLK_PERIOD: return mod_shift ? '>' : '.';
307 case SDLK_SLASH: return mod_shift ? '?' : '/';
308 case SDLK_0: return mod_shift ? ')' : '0';
309 case SDLK_1: return mod_shift ? '!' : '1';
310 case SDLK_2: return mod_shift ? '@' : '2';
311 case SDLK_3: return mod_shift ? '#' : '3';
312 case SDLK_4: return mod_shift ? '$' : '4';
313 case SDLK_5: return mod_shift ? '%' : '5';
314 case SDLK_6: return mod_shift ? '^' : '6';
315 case SDLK_7: return mod_shift ? '&' : '7';
316 case SDLK_8: return mod_shift ? '*' : '8';
317 case SDLK_9: return mod_shift ? '(' : '9';
318 case SDLK_COLON: return ':';
319 case SDLK_SEMICOLON: return mod_shift ? ':' : ';';
320 case SDLK_LESS: return '<';
321 case SDLK_EQUALS: return mod_shift ? '+' : '=';
322 case SDLK_GREATER: return '>';
323 case SDLK_QUESTION: return '?';
324 case SDLK_AT: return '@';
325 case SDLK_LEFTBRACKET: return mod_shift ? '{' : '[';
326 case SDLK_BACKSLASH: return mod_shift ? '|' : '\\';
327 case SDLK_RIGHTBRACKET: return mod_shift ? '}' : ']';
328 case SDLK_CARET: return '^';
329 case SDLK_UNDERSCORE: return '_';
330 case SDLK_BACKQUOTE: return mod_shift ? '~' : '`';
331 //case SDLK_DELETE: return 0x7F;
332 default: break;
333 }
334
335 return '\0';
336 }
337
338 SDL_Keycode Gamestate_Base::to_sym(const String &text_version) {
339
340 #define SC(name) if(text_version == #name) return name;
341
342 #if SDL_VERSION_ATLEAST(1,3,0)
343 #define SC0(b)
344 #define SC1(a) SC(a)
345 #define SC10(a, b) SC(a)
346 #else
347 #define SC0(b) SC(b)
348 #define SC1(a)
349 #define SC10(a, b) SC(b)
350 #endif
351
352 SC(SDLK_RETURN)
353 SC(SDLK_ESCAPE)
354 SC(SDLK_BACKSPACE)
355 SC(SDLK_TAB)
356 SC(SDLK_SPACE)
357 SC(SDLK_EXCLAIM)
358 SC(SDLK_QUOTEDBL)
359 SC(SDLK_HASH)
360 SC1(SDLK_PERCENT)
361 SC(SDLK_DOLLAR)
362 SC(SDLK_AMPERSAND)
363 SC(SDLK_QUOTE)
364 SC(SDLK_LEFTPAREN)
365 SC(SDLK_RIGHTPAREN)
366 SC(SDLK_ASTERISK)
367 SC(SDLK_PLUS)
368 SC(SDLK_COMMA)
369 SC(SDLK_MINUS)
370 SC(SDLK_PERIOD)
371 SC(SDLK_SLASH)
372 SC(SDLK_0)
373 SC(SDLK_1)
374 SC(SDLK_2)
375 SC(SDLK_3)
376 SC(SDLK_4)
377 SC(SDLK_5)
378 SC(SDLK_6)
379 SC(SDLK_7)
380 SC(SDLK_8)
381 SC(SDLK_9)
382 SC(SDLK_COLON)
383 SC(SDLK_SEMICOLON)
384 SC(SDLK_LESS)
385 SC(SDLK_EQUALS)
386 SC(SDLK_GREATER)
387 SC(SDLK_QUESTION)
388 SC(SDLK_AT)
389 SC(SDLK_LEFTBRACKET)
390 SC(SDLK_BACKSLASH)
391 SC(SDLK_RIGHTBRACKET)
392 SC(SDLK_CARET)
393 SC(SDLK_UNDERSCORE)
394 SC(SDLK_BACKQUOTE)
395 SC(SDLK_a)
396 SC(SDLK_b)
397 SC(SDLK_c)
398 SC(SDLK_d)
399 SC(SDLK_e)
400 SC(SDLK_f)
401 SC(SDLK_g)
402 SC(SDLK_h)
403 SC(SDLK_i)
404 SC(SDLK_j)
405 SC(SDLK_k)
406 SC(SDLK_l)
407 SC(SDLK_m)
408 SC(SDLK_n)
409 SC(SDLK_o)
410 SC(SDLK_p)
411 SC(SDLK_q)
412 SC(SDLK_r)
413 SC(SDLK_s)
414 SC(SDLK_t)
415 SC(SDLK_u)
416 SC(SDLK_v)
417 SC(SDLK_w)
418 SC(SDLK_x)
419 SC(SDLK_y)
420 SC(SDLK_z)
421
422 SC(SDLK_CAPSLOCK)
423
424 SC(SDLK_F1)
425 SC(SDLK_F2)
426 SC(SDLK_F3)
427 SC(SDLK_F4)
428 SC(SDLK_F5)
429 SC(SDLK_F6)
430 SC(SDLK_F7)
431 SC(SDLK_F8)
432 SC(SDLK_F9)
433 SC(SDLK_F10)
434 SC(SDLK_F11)
435 SC(SDLK_F12)
436
437 SC10(SDLK_PRINTSCREEN, SDLK_PRINT)
438 #if SDL_VERSION_ATLEAST(2,0,0)
439 SC(SDLK_SCROLLLOCK)
440 #else
441 SC(SDLK_SCROLLOCK)
442 #endif
443 SC(SDLK_PAUSE)
444 SC(SDLK_INSERT)
445 SC(SDLK_HOME)
446 SC(SDLK_PAGEUP)
447 SC(SDLK_DELETE)
448 SC(SDLK_END)
449 SC(SDLK_PAGEDOWN)
450 SC(SDLK_RIGHT)
451 SC(SDLK_LEFT)
452 SC(SDLK_DOWN)
453 SC(SDLK_UP)
454
455 SC10(SDLK_NUMLOCKCLEAR, SDLK_NUMLOCK)
456 SC(SDLK_KP_DIVIDE)
457 SC(SDLK_KP_MULTIPLY)
458 SC(SDLK_KP_MINUS)
459 SC(SDLK_KP_PLUS)
460 SC(SDLK_KP_ENTER)
461 SC10(SDLK_KP_1, SDLK_KP1)
462 SC10(SDLK_KP_2, SDLK_KP2)
463 SC10(SDLK_KP_3, SDLK_KP3)
464 SC10(SDLK_KP_4, SDLK_KP4)
465 SC10(SDLK_KP_5, SDLK_KP5)
466 SC10(SDLK_KP_6, SDLK_KP6)
467 SC10(SDLK_KP_7, SDLK_KP7)
468 SC10(SDLK_KP_8, SDLK_KP8)
469 SC10(SDLK_KP_9, SDLK_KP9)
470 SC10(SDLK_KP_0, SDLK_KP0)
471 SC(SDLK_KP_PERIOD)
472
473 SC10(SDLK_APPLICATION, SDLK_COMPOSE)
474 SC(SDLK_POWER)
475 SC(SDLK_KP_EQUALS)
476 SC(SDLK_F13)
477 SC(SDLK_F14)
478 SC(SDLK_F15)
479 SC1(SDLK_F16)
480 SC1(SDLK_F17)
481 SC1(SDLK_F18)
482 SC1(SDLK_F19)
483 SC1(SDLK_F20)
484 SC1(SDLK_F21)
485 SC1(SDLK_F22)
486 SC1(SDLK_F23)
487 SC1(SDLK_F24)
488 SC1(SDLK_EXECUTE)
489 SC(SDLK_HELP)
490 SC(SDLK_MENU)
491 SC1(SDLK_SELECT)
492 SC10(SDLK_STOP, SDLK_BREAK)
493 SC1(SDLK_AGAIN)
494 SC(SDLK_UNDO)
495 SC1(SDLK_CUT)
496 SC1(SDLK_COPY)
497 SC1(SDLK_PASTE)
498 SC1(SDLK_FIND)
499 SC1(SDLK_MUTE)
500 SC1(SDLK_VOLUMEUP)
501 SC1(SDLK_VOLUMEDOWN)
502 SC1(SDLK_KP_COMMA)
503 SC1(SDLK_KP_EQUALSAS400)
504
505 SC1(SDLK_ALTERASE)
506 SC(SDLK_SYSREQ)
507 SC1(SDLK_CANCEL)
508 SC(SDLK_CLEAR)
509 SC1(SDLK_PRIOR)
510 SC1(SDLK_RETURN2)
511 SC1(SDLK_SEPARATOR)
512 SC1(SDLK_OUT)
513 SC1(SDLK_OPER)
514 SC1(SDLK_CLEARAGAIN)
515 SC1(SDLK_CRSEL)
516 SC1(SDLK_EXSEL)
517
518 SC1(SDLK_KP_00)
519 SC1(SDLK_KP_000)
520 SC1(SDLK_THOUSANDSSEPARATOR)
521 SC1(SDLK_DECIMALSEPARATOR)
522 SC1(SDLK_CURRENCYUNIT)
523 SC1(SDLK_CURRENCYSUBUNIT)
524 SC1(SDLK_KP_LEFTPAREN)
525 SC1(SDLK_KP_RIGHTPAREN)
526 SC1(SDLK_KP_LEFTBRACE)
527 SC1(SDLK_KP_RIGHTBRACE)
528 SC1(SDLK_KP_TAB)
529 SC1(SDLK_KP_BACKSPACE)
530 SC1(SDLK_KP_A)
531 SC1(SDLK_KP_B)
532 SC1(SDLK_KP_C)
533 SC1(SDLK_KP_D)
534 SC1(SDLK_KP_E)
535 SC1(SDLK_KP_F)
536 SC1(SDLK_KP_XOR)
537 SC1(SDLK_KP_POWER)
538 SC1(SDLK_KP_PERCENT)
539 SC1(SDLK_KP_LESS)
540 SC1(SDLK_KP_GREATER)
541 SC1(SDLK_KP_AMPERSAND)
542 SC1(SDLK_KP_DBLAMPERSAND)
543 SC1(SDLK_KP_VERTICALBAR)
544 SC1(SDLK_KP_DBLVERTICALBAR)
545 SC1(SDLK_KP_COLON)
546 SC1(SDLK_KP_HASH)
547 SC1(SDLK_KP_SPACE)
548 SC1(SDLK_KP_AT)
549 SC1(SDLK_KP_EXCLAM)
550 SC1(SDLK_KP_MEMSTORE)
551 SC1(SDLK_KP_MEMRECALL)
552 SC1(SDLK_KP_MEMCLEAR)
553 SC1(SDLK_KP_MEMADD)
554 SC1(SDLK_KP_MEMSUBTRACT)
555 SC1(SDLK_KP_MEMMULTIPLY)
556 SC1(SDLK_KP_MEMDIVIDE)
557 SC1(SDLK_KP_PLUSMINUS)
558 SC1(SDLK_KP_CLEAR)
559 SC1(SDLK_KP_CLEARENTRY)
560 SC1(SDLK_KP_BINARY)
561 SC1(SDLK_KP_OCTAL)
562 SC1(SDLK_KP_DECIMAL)
563 SC1(SDLK_KP_HEXADECIMAL)
564
565 SC(SDLK_LCTRL)
566 SC(SDLK_LSHIFT)
567 SC(SDLK_LALT)
568 SC1(SDLK_LGUI)
569 SC0(SDLK_LMETA)
570 SC0(SDLK_LSUPER)
571 SC(SDLK_RCTRL)
572 SC(SDLK_RSHIFT)
573 SC(SDLK_RALT)
574 SC1(SDLK_RGUI)
575 SC0(SDLK_RMETA)
576 SC0(SDLK_RSUPER)
577
578 SC(SDLK_MODE)
579
580 SC1(SDLK_AUDIONEXT)
581 SC1(SDLK_AUDIOPREV)
582 SC1(SDLK_AUDIOSTOP)
583 SC1(SDLK_AUDIOPLAY)
584 SC1(SDLK_AUDIOMUTE)
585 SC1(SDLK_MEDIASELECT)
586 SC1(SDLK_WWW)
587 SC1(SDLK_MAIL)
588 SC1(SDLK_CALCULATOR)
589 SC1(SDLK_COMPUTER)
590 SC1(SDLK_AC_SEARCH)
591 SC1(SDLK_AC_HOME)
592 SC1(SDLK_AC_BACK)
593 SC1(SDLK_AC_FORWARD)
594 SC1(SDLK_AC_STOP)
595 SC1(SDLK_AC_REFRESH)
596 SC1(SDLK_AC_BOOKMARKS)
597
598 SC1(SDLK_BRIGHTNESSDOWN)
599 SC1(SDLK_BRIGHTNESSUP)
600 SC1(SDLK_DISPLAYSWITCH)
601 SC1(SDLK_KBDILLUMTOGGLE)
602 SC1(SDLK_KBDILLUMDOWN)
603 SC1(SDLK_KBDILLUMUP)
604 SC1(SDLK_EJECT)
605 SC1(SDLK_SLEEP)
606
607 SC0(SDLK_EURO)
608 SC0(SDLK_WORLD_0)
609 SC0(SDLK_WORLD_1)
610 SC0(SDLK_WORLD_2)
611 SC0(SDLK_WORLD_3)
612 SC0(SDLK_WORLD_4)
613 SC0(SDLK_WORLD_5)
614 SC0(SDLK_WORLD_6)
615 SC0(SDLK_WORLD_7)
616 SC0(SDLK_WORLD_8)
617 SC0(SDLK_WORLD_9)
618 SC0(SDLK_WORLD_10)
619 SC0(SDLK_WORLD_11)
620 SC0(SDLK_WORLD_12)
621 SC0(SDLK_WORLD_13)
622 SC0(SDLK_WORLD_14)
623 SC0(SDLK_WORLD_15)
624 SC0(SDLK_WORLD_16)
625 SC0(SDLK_WORLD_17)
626 SC0(SDLK_WORLD_18)
627 SC0(SDLK_WORLD_19)
628 SC0(SDLK_WORLD_20)
629 SC0(SDLK_WORLD_21)
630 SC0(SDLK_WORLD_22)
631 SC0(SDLK_WORLD_23)
632 SC0(SDLK_WORLD_24)
633 SC0(SDLK_WORLD_25)
634 SC0(SDLK_WORLD_26)
635 SC0(SDLK_WORLD_27)
636 SC0(SDLK_WORLD_28)
637 SC0(SDLK_WORLD_29)
638 SC0(SDLK_WORLD_30)
639 SC0(SDLK_WORLD_31)
640 SC0(SDLK_WORLD_32)
641 SC0(SDLK_WORLD_33)
642 SC0(SDLK_WORLD_34)
643 SC0(SDLK_WORLD_35)
644 SC0(SDLK_WORLD_36)
645 SC0(SDLK_WORLD_37)
646 SC0(SDLK_WORLD_38)
647 SC0(SDLK_WORLD_39)
648 SC0(SDLK_WORLD_40)
649 SC0(SDLK_WORLD_41)
650 SC0(SDLK_WORLD_42)
651 SC0(SDLK_WORLD_43)
652 SC0(SDLK_WORLD_44)
653 SC0(SDLK_WORLD_45)
654 SC0(SDLK_WORLD_46)
655 SC0(SDLK_WORLD_47)
656 SC0(SDLK_WORLD_48)
657 SC0(SDLK_WORLD_49)
658 SC0(SDLK_WORLD_50)
659 SC0(SDLK_WORLD_51)
660 SC0(SDLK_WORLD_52)
661 SC0(SDLK_WORLD_53)
662 SC0(SDLK_WORLD_54)
663 SC0(SDLK_WORLD_55)
664 SC0(SDLK_WORLD_56)
665 SC0(SDLK_WORLD_57)
666 SC0(SDLK_WORLD_58)
667 SC0(SDLK_WORLD_59)
668 SC0(SDLK_WORLD_60)
669 SC0(SDLK_WORLD_61)
670 SC0(SDLK_WORLD_62)
671 SC0(SDLK_WORLD_63)
672 SC0(SDLK_WORLD_64)
673 SC0(SDLK_WORLD_65)
674 SC0(SDLK_WORLD_66)
675 SC0(SDLK_WORLD_67)
676 SC0(SDLK_WORLD_68)
677 SC0(SDLK_WORLD_69)
678 SC0(SDLK_WORLD_70)
679 SC0(SDLK_WORLD_71)
680 SC0(SDLK_WORLD_72)
681 SC0(SDLK_WORLD_73)
682 SC0(SDLK_WORLD_74)
683 SC0(SDLK_WORLD_75)
684 SC0(SDLK_WORLD_76)
685 SC0(SDLK_WORLD_77)
686 SC0(SDLK_WORLD_78)
687 SC0(SDLK_WORLD_79)
688 SC0(SDLK_WORLD_80)
689 SC0(SDLK_WORLD_81)
690 SC0(SDLK_WORLD_82)
691 SC0(SDLK_WORLD_83)
692 SC0(SDLK_WORLD_84)
693 SC0(SDLK_WORLD_85)
694 SC0(SDLK_WORLD_86)
695 SC0(SDLK_WORLD_87)
696 SC0(SDLK_WORLD_88)
697 SC0(SDLK_WORLD_89)
698 SC0(SDLK_WORLD_90)
699 SC0(SDLK_WORLD_91)
700 SC0(SDLK_WORLD_92)
701 SC0(SDLK_WORLD_93)
702 SC0(SDLK_WORLD_94)
703 SC0(SDLK_WORLD_95)
704
705 #undef SC10
706 #undef SC1
707 #undef SC0
708 #undef SC
709
710 return SDLK_UNKNOWN;
711 }
712
713 //static String to_text_part_2(const SDL_Keycode &keysym);
714
715 String Gamestate_Base::to_text(const SDL_Keycode &sym) {
716 switch(sym) {
717
718 #define SC(name) case name: return #name;
719
720 #if SDL_VERSION_ATLEAST(1,3,0)
721 #define SC0(b)
722 #define SC1(a) SC(a)
723 #define SC10(a, b) SC(a)
724 #else
725 #define SC0(b) SC(b)
726 #define SC1(a)
727 #define SC10(a, b) SC(b)
728 #endif
729
730 SC(SDLK_RETURN)
731 SC(SDLK_ESCAPE)
732 SC(SDLK_BACKSPACE)
733 SC(SDLK_TAB)
734 SC(SDLK_SPACE)
735 SC(SDLK_EXCLAIM)
736 SC(SDLK_QUOTEDBL)
737 SC(SDLK_HASH)
738 SC1(SDLK_PERCENT)
739 SC(SDLK_DOLLAR)
740 SC(SDLK_AMPERSAND)
741 SC(SDLK_QUOTE)
742 SC(SDLK_LEFTPAREN)
743 SC(SDLK_RIGHTPAREN)
744 SC(SDLK_ASTERISK)
745 SC(SDLK_PLUS)
746 SC(SDLK_COMMA)
747 SC(SDLK_MINUS)
748 SC(SDLK_PERIOD)
749 SC(SDLK_SLASH)
750 SC(SDLK_0)
751 SC(SDLK_1)
752 SC(SDLK_2)
753 SC(SDLK_3)
754 SC(SDLK_4)
755 SC(SDLK_5)
756 SC(SDLK_6)
757 SC(SDLK_7)
758 SC(SDLK_8)
759 SC(SDLK_9)
760 SC(SDLK_COLON)
761 SC(SDLK_SEMICOLON)
762 SC(SDLK_LESS)
763 SC(SDLK_EQUALS)
764 SC(SDLK_GREATER)
765 SC(SDLK_QUESTION)
766 SC(SDLK_AT)
767 SC(SDLK_LEFTBRACKET)
768 SC(SDLK_BACKSLASH)
769 SC(SDLK_RIGHTBRACKET)
770 SC(SDLK_CARET)
771 SC(SDLK_UNDERSCORE)
772 SC(SDLK_BACKQUOTE)
773 SC(SDLK_a)
774 SC(SDLK_b)
775 SC(SDLK_c)
776 SC(SDLK_d)
777 SC(SDLK_e)
778 SC(SDLK_f)
779 SC(SDLK_g)
780 SC(SDLK_h)
781 SC(SDLK_i)
782 SC(SDLK_j)
783 SC(SDLK_k)
784 SC(SDLK_l)
785 SC(SDLK_m)
786 SC(SDLK_n)
787 SC(SDLK_o)
788 SC(SDLK_p)
789 SC(SDLK_q)
790 SC(SDLK_r)
791 SC(SDLK_s)
792 SC(SDLK_t)
793 SC(SDLK_u)
794 SC(SDLK_v)
795 SC(SDLK_w)
796 SC(SDLK_x)
797 SC(SDLK_y)
798 SC(SDLK_z)
799
800 SC(SDLK_CAPSLOCK)
801
802 SC(SDLK_F1)
803 SC(SDLK_F2)
804 SC(SDLK_F3)
805 SC(SDLK_F4)
806 SC(SDLK_F5)
807 SC(SDLK_F6)
808 SC(SDLK_F7)
809 SC(SDLK_F8)
810 SC(SDLK_F9)
811 SC(SDLK_F10)
812 SC(SDLK_F11)
813 SC(SDLK_F12)
814
815 SC10(SDLK_PRINTSCREEN, SDLK_PRINT)
816 #if SDL_VERSION_ATLEAST(2,0,0)
817 SC(SDLK_SCROLLLOCK)
818 #else
819 SC(SDLK_SCROLLOCK)
820 #endif
821 SC(SDLK_PAUSE)
822 SC(SDLK_INSERT)
823 SC(SDLK_HOME)
824 SC(SDLK_PAGEUP)
825 SC(SDLK_DELETE)
826 SC(SDLK_END)
827 SC(SDLK_PAGEDOWN)
828 SC(SDLK_RIGHT)
829 SC(SDLK_LEFT)
830 SC(SDLK_DOWN)
831 SC(SDLK_UP)
832
833 SC10(SDLK_NUMLOCKCLEAR, SDLK_NUMLOCK)
834 SC(SDLK_KP_DIVIDE)
835 SC(SDLK_KP_MULTIPLY)
836 SC(SDLK_KP_MINUS)
837 SC(SDLK_KP_PLUS)
838 SC(SDLK_KP_ENTER)
839 SC10(SDLK_KP_1, SDLK_KP1)
840 SC10(SDLK_KP_2, SDLK_KP2)
841 SC10(SDLK_KP_3, SDLK_KP3)
842 SC10(SDLK_KP_4, SDLK_KP4)
843 SC10(SDLK_KP_5, SDLK_KP5)
844 SC10(SDLK_KP_6, SDLK_KP6)
845 SC10(SDLK_KP_7, SDLK_KP7)
846 SC10(SDLK_KP_8, SDLK_KP8)
847 SC10(SDLK_KP_9, SDLK_KP9)
848 SC10(SDLK_KP_0, SDLK_KP0)
849 SC(SDLK_KP_PERIOD)
850
851 SC10(SDLK_APPLICATION, SDLK_COMPOSE)
852 SC(SDLK_POWER)
853 SC(SDLK_KP_EQUALS)
854 SC(SDLK_F13)
855 SC(SDLK_F14)
856 SC(SDLK_F15)
857 SC1(SDLK_F16)
858 SC1(SDLK_F17)
859 SC1(SDLK_F18)
860 SC1(SDLK_F19)
861 SC1(SDLK_F20)
862 SC1(SDLK_F21)
863 SC1(SDLK_F22)
864 SC1(SDLK_F23)
865 SC1(SDLK_F24)
866 SC1(SDLK_EXECUTE)
867 SC(SDLK_HELP)
868 SC(SDLK_MENU)
869 SC1(SDLK_SELECT)
870 SC10(SDLK_STOP, SDLK_BREAK)
871 SC1(SDLK_AGAIN)
872 SC(SDLK_UNDO)
873 SC1(SDLK_CUT)
874 SC1(SDLK_COPY)
875 SC1(SDLK_PASTE)
876 SC1(SDLK_FIND)
877 SC1(SDLK_MUTE)
878 SC1(SDLK_VOLUMEUP)
879 SC1(SDLK_VOLUMEDOWN)
880 SC1(SDLK_KP_COMMA)
881 SC1(SDLK_KP_EQUALSAS400)
882
883 SC1(SDLK_ALTERASE)
884 SC(SDLK_SYSREQ)
885 SC1(SDLK_CANCEL)
886 SC(SDLK_CLEAR)
887 SC1(SDLK_PRIOR)
888 SC1(SDLK_RETURN2)
889 SC1(SDLK_SEPARATOR)
890 SC1(SDLK_OUT)
891 SC1(SDLK_OPER)
892 SC1(SDLK_CLEARAGAIN)
893 SC1(SDLK_CRSEL)
894 SC1(SDLK_EXSEL)
895
896 SC1(SDLK_KP_00)
897 SC1(SDLK_KP_000)
898 SC1(SDLK_THOUSANDSSEPARATOR)
899 SC1(SDLK_DECIMALSEPARATOR)
900 SC1(SDLK_CURRENCYUNIT)
901 SC1(SDLK_CURRENCYSUBUNIT)
902 SC1(SDLK_KP_LEFTPAREN)
903 SC1(SDLK_KP_RIGHTPAREN)
904 SC1(SDLK_KP_LEFTBRACE)
905 SC1(SDLK_KP_RIGHTBRACE)
906 SC1(SDLK_KP_TAB)
907 SC1(SDLK_KP_BACKSPACE)
908 SC1(SDLK_KP_A)
909 SC1(SDLK_KP_B)
910 SC1(SDLK_KP_C)
911 SC1(SDLK_KP_D)
912 SC1(SDLK_KP_E)
913 SC1(SDLK_KP_F)
914 SC1(SDLK_KP_XOR)
915 SC1(SDLK_KP_POWER)
916 SC1(SDLK_KP_PERCENT)
917 SC1(SDLK_KP_LESS)
918 SC1(SDLK_KP_GREATER)
919 SC1(SDLK_KP_AMPERSAND)
920 SC1(SDLK_KP_DBLAMPERSAND)
921 SC1(SDLK_KP_VERTICALBAR)
922 SC1(SDLK_KP_DBLVERTICALBAR)
923 SC1(SDLK_KP_COLON)
924 SC1(SDLK_KP_HASH)
925 SC1(SDLK_KP_SPACE)
926 SC1(SDLK_KP_AT)
927 SC1(SDLK_KP_EXCLAM)
928 SC1(SDLK_KP_MEMSTORE)
929 SC1(SDLK_KP_MEMRECALL)
930 SC1(SDLK_KP_MEMCLEAR)
931 SC1(SDLK_KP_MEMADD)
932 SC1(SDLK_KP_MEMSUBTRACT)
933 SC1(SDLK_KP_MEMMULTIPLY)
934 SC1(SDLK_KP_MEMDIVIDE)
935 SC1(SDLK_KP_PLUSMINUS)
936 SC1(SDLK_KP_CLEAR)
937 SC1(SDLK_KP_CLEARENTRY)
938 SC1(SDLK_KP_BINARY)
939 SC1(SDLK_KP_OCTAL)
940 SC1(SDLK_KP_DECIMAL)
941 SC1(SDLK_KP_HEXADECIMAL)
942
943 SC(SDLK_LCTRL)
944 SC(SDLK_LSHIFT)
945 SC(SDLK_LALT)
946 SC1(SDLK_LGUI)
947 SC0(SDLK_LMETA)
948 SC0(SDLK_LSUPER)
949 SC(SDLK_RCTRL)
950 SC(SDLK_RSHIFT)
951 SC(SDLK_RALT)
952 SC1(SDLK_RGUI)
953 SC0(SDLK_RMETA)
954 SC0(SDLK_RSUPER)
955
956 SC(SDLK_MODE)
957
958 SC1(SDLK_AUDIONEXT)
959 SC1(SDLK_AUDIOPREV)
960 SC1(SDLK_AUDIOSTOP)
961 SC1(SDLK_AUDIOPLAY)
962 SC1(SDLK_AUDIOMUTE)
963 SC1(SDLK_MEDIASELECT)
964 SC1(SDLK_WWW)
965 SC1(SDLK_MAIL)
966 SC1(SDLK_CALCULATOR)
967 SC1(SDLK_COMPUTER)
968 SC1(SDLK_AC_SEARCH)
969 SC1(SDLK_AC_HOME)
970 SC1(SDLK_AC_BACK)
971 SC1(SDLK_AC_FORWARD)
972 SC1(SDLK_AC_STOP)
973 SC1(SDLK_AC_REFRESH)
974 SC1(SDLK_AC_BOOKMARKS)
975
976 SC1(SDLK_BRIGHTNESSDOWN)
977 SC1(SDLK_BRIGHTNESSUP)
978 SC1(SDLK_DISPLAYSWITCH)
979 SC1(SDLK_KBDILLUMTOGGLE)
980 SC1(SDLK_KBDILLUMDOWN)
981 SC1(SDLK_KBDILLUMUP)
982 SC1(SDLK_EJECT)
983 SC1(SDLK_SLEEP)
984
985 SC0(SDLK_EURO)
986 SC0(SDLK_WORLD_0)
987 SC0(SDLK_WORLD_1)
988 SC0(SDLK_WORLD_2)
989 SC0(SDLK_WORLD_3)
990 SC0(SDLK_WORLD_4)
991 SC0(SDLK_WORLD_5)
992 SC0(SDLK_WORLD_6)
993 SC0(SDLK_WORLD_7)
994 SC0(SDLK_WORLD_8)
995 SC0(SDLK_WORLD_9)
996 SC0(SDLK_WORLD_10)
997 SC0(SDLK_WORLD_11)
998 SC0(SDLK_WORLD_12)
999 SC0(SDLK_WORLD_13)
1000 SC0(SDLK_WORLD_14)
1001 SC0(SDLK_WORLD_15)
1002 SC0(SDLK_WORLD_16)
1003 SC0(SDLK_WORLD_17)
1004 SC0(SDLK_WORLD_18)
1005 SC0(SDLK_WORLD_19)
1006 SC0(SDLK_WORLD_20)
1007 SC0(SDLK_WORLD_21)
1008 SC0(SDLK_WORLD_22)
1009 SC0(SDLK_WORLD_23)
1010 SC0(SDLK_WORLD_24)
1011 SC0(SDLK_WORLD_25)
1012 SC0(SDLK_WORLD_26)
1013 SC0(SDLK_WORLD_27)
1014 SC0(SDLK_WORLD_28)
1015 SC0(SDLK_WORLD_29)
1016 SC0(SDLK_WORLD_30)
1017 SC0(SDLK_WORLD_31)
1018 SC0(SDLK_WORLD_32)
1019 SC0(SDLK_WORLD_33)
1020 SC0(SDLK_WORLD_34)
1021 SC0(SDLK_WORLD_35)
1022 SC0(SDLK_WORLD_36)
1023 SC0(SDLK_WORLD_37)
1024 SC0(SDLK_WORLD_38)
1025 SC0(SDLK_WORLD_39)
1026 SC0(SDLK_WORLD_40)
1027 SC0(SDLK_WORLD_41)
1028 SC0(SDLK_WORLD_42)
1029 SC0(SDLK_WORLD_43)
1030 SC0(SDLK_WORLD_44)
1031 SC0(SDLK_WORLD_45)
1032 SC0(SDLK_WORLD_46)
1033 SC0(SDLK_WORLD_47)
1034 SC0(SDLK_WORLD_48)
1035 SC0(SDLK_WORLD_49)
1036 SC0(SDLK_WORLD_50)
1037 SC0(SDLK_WORLD_51)
1038 SC0(SDLK_WORLD_52)
1039 SC0(SDLK_WORLD_53)
1040 SC0(SDLK_WORLD_54)
1041 SC0(SDLK_WORLD_55)
1042 SC0(SDLK_WORLD_56)
1043 SC0(SDLK_WORLD_57)
1044 SC0(SDLK_WORLD_58)
1045 SC0(SDLK_WORLD_59)
1046 SC0(SDLK_WORLD_60)
1047 SC0(SDLK_WORLD_61)
1048 SC0(SDLK_WORLD_62)
1049 SC0(SDLK_WORLD_63)
1050 SC0(SDLK_WORLD_64)
1051 SC0(SDLK_WORLD_65)
1052 SC0(SDLK_WORLD_66)
1053 SC0(SDLK_WORLD_67)
1054 SC0(SDLK_WORLD_68)
1055 SC0(SDLK_WORLD_69)
1056 SC0(SDLK_WORLD_70)
1057 SC0(SDLK_WORLD_71)
1058 SC0(SDLK_WORLD_72)
1059 SC0(SDLK_WORLD_73)
1060 SC0(SDLK_WORLD_74)
1061 SC0(SDLK_WORLD_75)
1062 SC0(SDLK_WORLD_76)
1063 SC0(SDLK_WORLD_77)
1064 SC0(SDLK_WORLD_78)
1065 SC0(SDLK_WORLD_79)
1066 SC0(SDLK_WORLD_80)
1067 SC0(SDLK_WORLD_81)
1068 SC0(SDLK_WORLD_82)
1069 SC0(SDLK_WORLD_83)
1070 SC0(SDLK_WORLD_84)
1071 SC0(SDLK_WORLD_85)
1072 SC0(SDLK_WORLD_86)
1073 SC0(SDLK_WORLD_87)
1074 SC0(SDLK_WORLD_88)
1075 SC0(SDLK_WORLD_89)
1076 SC0(SDLK_WORLD_90)
1077 SC0(SDLK_WORLD_91)
1078 SC0(SDLK_WORLD_92)
1079 SC0(SDLK_WORLD_93)
1080 SC0(SDLK_WORLD_94)
1081 SC0(SDLK_WORLD_95)
1082
1083 #undef SC10
1084 #undef SC1
1085 #undef SC0
1086 #undef SC
1087
1088 default: return "SDLK_UNKNOWN";
1089 }
1090 }
1091 #endif
1092
1093 void Gamestate_Base::render() {
1094 static Logo logo(Point2f(1.5f, 0.5f), 1.0f, Color(1.0f, 0.875f, 0.875f, 0.875f), Color(1.0f, 0.125f, 0.125f, 0.175f));
1095
1096 get_Video().set_2d(std::make_pair(Point2f(), Point2f(4.0f, 2.0f)), true);
1097
1098 logo.render();
1099 }
1100
1101 void Gamestate_Base::on_push() {
1102 }
1103
1104 void Gamestate_Base::on_cover() {
1105 }
1106
1107 void Gamestate_Base::on_uncover() {
1108 }
1109
1110 void Gamestate_Base::on_pop() {
1111 }
1112
1113 Gamestate::~Gamestate() {
1114 if(m_state)
1115 m_state->decrement();
1116 }
1117
1118 }
1119
1120 #include <Zeni/Undefine.h>
SDLK_F13
Definition: SDL_keycode.h:174
SDLK_EJECT
Definition: SDL_keycode.h:310
SDLK_f
Definition: SDL_keycode.h:102
SDLK_KP_MEMADD
Definition: SDL_keycode.h:258
SDLK_KP_D
Definition: SDL_keycode.h:235
SDLK_KBDILLUMDOWN
Definition: SDL_keycode.h:308
Zeni::Logo
Logo.
Definition: Logo.h:42
SDL_Event::motion
SDL_MouseMotionEvent motion
Definition: SDL_events.h:503
SDLK_SELECT
Definition: SDL_keycode.h:189
SDLK_KP_EQUALS
Definition: SDL_keycode.h:173
SDLK_EQUALS
Definition: SDL_keycode.h:84
SDLK_KP_MULTIPLY
Definition: SDL_keycode.h:155
SDLK_F18
Definition: SDL_keycode.h:179
Zeni::Window::get_mouse_state
Mouse_State get_mouse_state() const
Find out if the mouse cursor is grabbed/hidden/relative.
Definition: Window.cpp:465
SDLK_2
Definition: SDL_keycode.h:73
SDLK_AUDIOSTOP
Definition: SDL_keycode.h:286
Zeni::Gamestate_Base::on_controller_axis
virtual void on_controller_axis(const SDL_ControllerAxisEvent &event)
Override this input callback in your Gamestates. See SDL documentation for details.
Definition: Gamestate.cpp:115
Zeni::get_Controllers
Controllers & get_Controllers()
Get access to the singleton.
Definition: Controllers.cpp:59
SDLK_F3
Definition: SDL_keycode.h:128
SDL_KEYDOWN
Definition: SDL_events.h:93
SDL_Event::caxis
SDL_ControllerAxisEvent caxis
Definition: SDL_events.h:511
SDLK_QUESTION
Definition: SDL_keycode.h:86
SDL_QuitEvent
The &quot;quit requested&quot; event.
Definition: SDL_events.h:447
SDLK_F15
Definition: SDL_keycode.h:176
SDLK_KP_MEMSUBTRACT
Definition: SDL_keycode.h:259
SDLK_AMPERSAND
Definition: SDL_keycode.h:61
SDL_ControllerDeviceEvent
Controller device event structure (event.cdevice.*)
Definition: SDL_events.h:373
Zeni::Gamestate_Base::render
virtual void render()
Then render. Called by Game as part of the main gameloop.
Definition: Gamestate.cpp:1093
Zeni::Gamestate_Base::on_video_expose
virtual void on_video_expose(const SDL_ExposeEvent &event)
Override this input callback in your Gamestates. See SDL documentation for details.
Definition: Gamestate.cpp:177
SDLK_KP_EXCLAM
Definition: SDL_keycode.h:254
SDLK_1
Definition: SDL_keycode.h:72
SDLK_KP_00
Definition: SDL_keycode.h:217
SDLK_DECIMALSEPARATOR
Definition: SDL_keycode.h:221
SDLK_RCTRL
Definition: SDL_keycode.h:277
SDLK_F8
Definition: SDL_keycode.h:133
SDLK_F21
Definition: SDL_keycode.h:182
SDLK_F9
Definition: SDL_keycode.h:134
SDLK_LSHIFT
Definition: SDL_keycode.h:274
SDL_MOUSEBUTTONUP
Definition: SDL_events.h:101
SDLK_ASTERISK
Definition: SDL_keycode.h:65
SDLK_j
Definition: SDL_keycode.h:106
SDLK_o
Definition: SDL_keycode.h:111
SDLK_PASTE
Definition: SDL_keycode.h:195
SDL_CONTROLLERDEVICEREMOVED
Definition: SDL_events.h:118
SDL_Event::cdevice
SDL_ControllerDeviceEvent cdevice
Definition: SDL_events.h:513
SDLK_SLEEP
Definition: SDL_keycode.h:311
SDLK_SYSREQ
Definition: SDL_keycode.h:205
f
GLclampf f
Definition: glew.h:3390
SDLK_AUDIOPREV
Definition: SDL_keycode.h:285
SDLK_KP_PERCENT
Definition: SDL_keycode.h:240
Zeni::Gamestate_Base::on_quit
virtual void on_quit(const SDL_QuitEvent &event)
Override this input callback in your Gamestates. See SDL documentation for details.
Definition: Gamestate.cpp:124
SDLK_KP_HASH
Definition: SDL_keycode.h:251
Zeni::Video::change_resolution
static void change_resolution(const Point2i &resolution)
Definition: Video.cpp:366
Zeni::Gamestate_Base::to_text
static String to_text(const SDL_Keycode &sym)
Convert a sym to a text representation.
Definition: Gamestate.cpp:715
SDLK_AUDIOPLAY
Definition: SDL_keycode.h:287
SDLK_UNDO
Definition: SDL_keycode.h:192
SDLK_KP_LEFTBRACE
Definition: SDL_keycode.h:228
SDLK_DELETE
Definition: SDL_keycode.h:145
Zeni::Gamestate_Base::to_sym
static SDL_Keycode to_sym(const String &text_version)
Convert a text representation to an actual sym.
Definition: Gamestate.cpp:338
SDLK_VOLUMEDOWN
Definition: SDL_keycode.h:199
Zeni::Game::get_key_state
bool get_key_state(const int &key) const
Get the state of a key.
Definition: Game.cpp:287
SDLK_KP_MEMCLEAR
Definition: SDL_keycode.h:257
SDLK_SLASH
Definition: SDL_keycode.h:70
Zeni::Gamestate_Base::on_pop
virtual void on_pop()
Called when the Gamestate is popped off the stack in Game.
Definition: Gamestate.cpp:1110
SDLK_F2
Definition: SDL_keycode.h:127
SDLK_BACKSPACE
Definition: SDL_keycode.h:53
SDL_SYSWMEVENT
Definition: SDL_events.h:90
SDLK_z
Definition: SDL_keycode.h:122
SDLK_PERCENT
Definition: SDL_keycode.h:59
SDLK_CANCEL
Definition: SDL_keycode.h:206
sym
SDL_Keycode sym
Definition: SDL_pspevents.c:51
SDL_MOUSEBUTTONDOWN
Definition: SDL_events.h:100
SDLK_d
Definition: SDL_keycode.h:100
SDL_QUIT
Definition: SDL_events.h:60
SDLK_KP_BACKSPACE
Definition: SDL_keycode.h:231
SDLK_AC_FORWARD
Definition: SDL_keycode.h:297
SDLK_AC_BOOKMARKS
Definition: SDL_keycode.h:300
SDLK_3
Definition: SDL_keycode.h:74
Zeni::Window::Mouse_State
Mouse_State
Definition: Window.h:98
SDL_USEREVENT
Definition: SDL_events.h:140
SDLK_8
Definition: SDL_keycode.h:79
SDLK_6
Definition: SDL_keycode.h:77
zeni_rest.h
Zeni::Window::MOUSE_NORMAL
Definition: Window.h:98
SDLK_KP_RIGHTBRACE
Definition: SDL_keycode.h:229
SDL_KeyboardEvent::state
Uint8 state
Definition: SDL_events.h:181
SDLK_KP_LESS
Definition: SDL_keycode.h:241
SDLK_HELP
Definition: SDL_keycode.h:187
SDLK_AGAIN
Definition: SDL_keycode.h:191
Zeni::Controllers::enable
void enable(const bool &enable_)
Temporarily turn controller input on/off.
Definition: Controllers.cpp:92
SDLK_GREATER
Definition: SDL_keycode.h:85
SDLK_F1
Definition: SDL_keycode.h:126
Zeni::Window::set_mouse_state
void set_mouse_state(const Mouse_State &mouse_state)
Definition: Window.cpp:478
SC1
#define SC1(a)
SDL_Keysym
The SDL keysym structure, used in key events.
Definition: SDL_keyboard.h:47
SC0
#define SC0(b)
SDLK_l
Definition: SDL_keycode.h:108
SDLK_SEMICOLON
Definition: SDL_keycode.h:82
Zeni::Logo::render
void render()
Definition: Logo.cpp:63
SDLK_EXSEL
Definition: SDL_keycode.h:215
SDLK_s
Definition: SDL_keycode.h:115
SDLK_KP_PLUS
Definition: SDL_keycode.h:157
SDLK_KP_BINARY
Definition: SDL_keycode.h:267
SDLK_KP_EQUALSAS400
Definition: SDL_keycode.h:201
SDL_ControllerAxisEvent
Game controller axis motion event structure (event.caxis.*)
Definition: SDL_events.h:341
SDL_Event::quit
SDL_QuitEvent quit
Definition: SDL_events.h:514
SDLK_CUT
Definition: SDL_keycode.h:193
Undefine.h
SDLK_CLEARAGAIN
Definition: SDL_keycode.h:213
SDLK_F24
Definition: SDL_keycode.h:185
Zeni::Gamestate_Base::on_system_wm_event
virtual void on_system_wm_event(const SDL_SysWMEvent &event)
Override this input callback in your Gamestates. See SDL documentation for details.
Definition: Gamestate.cpp:127
SDL_MOUSEWHEEL
Definition: SDL_events.h:102
SDLK_KP_DBLAMPERSAND
Definition: SDL_keycode.h:244
SDLK_F16
Definition: SDL_keycode.h:177
SDL_CONTROLLERDEVICEADDED
Definition: SDL_events.h:117
SDLK_KP_COLON
Definition: SDL_keycode.h:250
SDLK_F6
Definition: SDL_keycode.h:131
SDLK_F23
Definition: SDL_keycode.h:184
SDLK_KP_DBLVERTICALBAR
Definition: SDL_keycode.h:248
SDLK_KP_SPACE
Definition: SDL_keycode.h:252
SDLK_BACKQUOTE
Definition: SDL_keycode.h:96
SDL_Keycode
Sint32 SDL_Keycode
The SDL virtual key representation.
Definition: SDL_keycode.h:42
SDLK_a
Definition: SDL_keycode.h:97
SDLK_KP_AMPERSAND
Definition: SDL_keycode.h:243
SDLK_g
Definition: SDL_keycode.h:103
SDLK_e
Definition: SDL_keycode.h:101
SDLK_F17
Definition: SDL_keycode.h:178
SDLK_COLON
Definition: SDL_keycode.h:81
SDLK_0
Definition: SDL_keycode.h:71
SDL_Event::wheel
SDL_MouseWheelEvent wheel
Definition: SDL_events.h:505
Zeni::get_Game
Game & get_Game()
Get access to the singleton.
Definition: Game.cpp:58
Zeni::Game
The Gamestate Stack.
Definition: Game.h:71
SDLK_LEFT
Definition: SDL_keycode.h:149
Zeni::Gamestate_Base::to_char
static char to_char(const SDL_Keysym &ks)
Returns a character key corresponding to the current combination of keys pressed or the null characte...
Definition: Gamestate.cpp:184
Zeni::Gamestate_Base::on_key
virtual void on_key(const SDL_KeyboardEvent &event)
Override this input callback in your Gamestates. See SDL documentation for details.
Definition: Gamestate.cpp:99
SDLK_PERIOD
Definition: SDL_keycode.h:69
SDLK_n
Definition: SDL_keycode.h:110
Zeni::String
Definition: String.h:29
SDLK_c
Definition: SDL_keycode.h:99
SDL_CONTROLLERBUTTONUP
Definition: SDL_events.h:116
SDLK_COMPUTER
Definition: SDL_keycode.h:293
SDLK_CAPSLOCK
Definition: SDL_keycode.h:124
SDLK_CRSEL
Definition: SDL_keycode.h:214
Zeni::Gamestate_Base::on_controller_device
virtual void on_controller_device(const SDL_ControllerDeviceEvent &event)
Override this input callback in your Gamestates. See SDL documentation for details.
Definition: Gamestate.cpp:121
SDLK_KP_OCTAL
Definition: SDL_keycode.h:268
SDLK_PRIOR
Definition: SDL_keycode.h:208
SDLK_VOLUMEUP
Definition: SDL_keycode.h:198
SDLK_KP_CLEARENTRY
Definition: SDL_keycode.h:266
SDLK_END
Definition: SDL_keycode.h:146
SDLK_UNKNOWN
Definition: SDL_keycode.h:49
SDL_WINDOWEVENT_FOCUS_GAINED
Definition: SDL_video.h:152
Zeni::Game::push_Popup_Pause_State
void push_Popup_Pause_State()
Definition: Game.cpp:551
SDL_Event::window
SDL_WindowEvent window
Definition: SDL_events.h:499
SDL_UserEvent
A user-defined event type (event.user.*)
Definition: SDL_events.h:465
SDLK_KP_PLUSMINUS
Definition: SDL_keycode.h:264
SDLK_i
Definition: SDL_keycode.h:105
SDLK_ESCAPE
Definition: SDL_keycode.h:52
SDLK_HOME
Definition: SDL_keycode.h:143
android_app
Definition: android_native_app_glue.h:111
SDLK_KP_4
Definition: SDL_keycode.h:162
SDLK_KP_POWER
Definition: SDL_keycode.h:239
SDLK_KP_LEFTPAREN
Definition: SDL_keycode.h:226
SDL_KeyboardEvent
Keyboard button event structure (event.key.*)
Definition: SDL_events.h:176
SDLK_RETURN
Definition: SDL_keycode.h:51
SDLK_CLEAR
Definition: SDL_keycode.h:207
SDLK_AC_REFRESH
Definition: SDL_keycode.h:299
SDLK_KP_6
Definition: SDL_keycode.h:164
SDLK_PLUS
Definition: SDL_keycode.h:66
SDLK_k
Definition: SDL_keycode.h:107
SDLK_COMMA
Definition: SDL_keycode.h:67
SDLK_RSHIFT
Definition: SDL_keycode.h:278
SDLK_OUT
Definition: SDL_keycode.h:211
SDLK_KP_2
Definition: SDL_keycode.h:160
SDLK_4
Definition: SDL_keycode.h:75
SDLK_KP_TAB
Definition: SDL_keycode.h:230
SDLK_LGUI
Definition: SDL_keycode.h:276
SDLK_KP_5
Definition: SDL_keycode.h:163
Define.h
SDLK_DISPLAYSWITCH
Definition: SDL_keycode.h:305
SDLK_CURRENCYSUBUNIT
Definition: SDL_keycode.h:224
SDLK_KP_VERTICALBAR
Definition: SDL_keycode.h:246
SDLK_DOLLAR
Definition: SDL_keycode.h:60
SDLK_KP_DIVIDE
Definition: SDL_keycode.h:154
SDLK_AC_BACK
Definition: SDL_keycode.h:296
SDLK_EXCLAIM
Definition: SDL_keycode.h:56
SDLK_STOP
Definition: SDL_keycode.h:190
SDLK_7
Definition: SDL_keycode.h:78
KMOD_CAPS
Definition: SDL_keycode.h:329
SDLK_F12
Definition: SDL_keycode.h:137
SDL_KEYUP
Definition: SDL_events.h:94
Zeni::Gamestate_Base::on_controller_button
virtual void on_controller_button(const SDL_ControllerButtonEvent &event)
Override this input callback in your Gamestates. See SDL documentation for details.
Definition: Gamestate.cpp:118
SDLK_AUDIONEXT
Definition: SDL_keycode.h:284
Zeni::Video::set_2d
void set_2d()
Set the default 2D view filling the entire display area.
Definition: Video.hxx:93
SDLK_KP_AT
Definition: SDL_keycode.h:253
KMOD_NUM
Definition: SDL_keycode.h:328
SDLK_PRINTSCREEN
Definition: SDL_keycode.h:139
SDLK_FIND
Definition: SDL_keycode.h:196
SDLK_m
Definition: SDL_keycode.h:109
SDLK_KP_3
Definition: SDL_keycode.h:161
SDLK_BACKSLASH
Definition: SDL_keycode.h:92
SC10
#define SC10(a, b)
SDL_WindowEvent::data2
Sint32 data2
Definition: SDL_events.h:170
SDLK_KP_COMMA
Definition: SDL_keycode.h:200
SDLK_u
Definition: SDL_keycode.h:117
SDL_WINDOWEVENT_FOCUS_LOST
Definition: SDL_video.h:153
Zeni::Gamestate_Base::on_mouse_motion
virtual void on_mouse_motion(const SDL_MouseMotionEvent &event)
Override this input callback in your Gamestates. See SDL documentation for details.
Definition: Gamestate.cpp:104
SDLK_MAIL
Definition: SDL_keycode.h:291
SDLK_OPER
Definition: SDL_keycode.h:212
SDLK_KBDILLUMTOGGLE
Definition: SDL_keycode.h:306
SDLK_h
Definition: SDL_keycode.h:104
SDLK_LALT
Definition: SDL_keycode.h:275
SDL_WINDOWEVENT
Definition: SDL_events.h:89
SDLK_KP_7
Definition: SDL_keycode.h:165
SDLK_AT
Definition: SDL_keycode.h:87
SDL_CONTROLLERBUTTONDOWN
Definition: SDL_events.h:115
SDLK_ALTERASE
Definition: SDL_keycode.h:204
Zeni::Gamestate_Base::on_event
virtual void on_event(const SDL_Event &event)
First check for events. Called by Game as part of the main gameloop.
Definition: Gamestate.cpp:36
Zeni::Gamestate_Base::on_uncover
virtual void on_uncover()
Called when a Gamestate is popped off Game, making this Gamestate on top.
Definition: Gamestate.cpp:1107
Zeni::Gamestate::~Gamestate
~Gamestate()
Definition: Gamestate.cpp:1113
SDL_WindowEvent::event
Uint8 event
Definition: SDL_events.h:165
SDL_KeyboardEvent::keysym
SDL_Keysym keysym
Definition: SDL_events.h:185
SDLK_KP_MEMSTORE
Definition: SDL_keycode.h:255
SDLK_KP_000
Definition: SDL_keycode.h:218
Zeni::Video::save
static void save(const bool &backup=true)
Save options.
Definition: Video.cpp:389
SDLK_KP_PERIOD
Definition: SDL_keycode.h:169
SDLK_RETURN2
Definition: SDL_keycode.h:209
SDLK_MINUS
Definition: SDL_keycode.h:68
SDL_CONTROLLERDEVICEREMAPPED
Definition: SDL_events.h:119
SDLK_RIGHTBRACKET
Definition: SDL_keycode.h:93
SDLK_MUTE
Definition: SDL_keycode.h:197
SC
#define SC(name)
SDLK_PAGEDOWN
Definition: SDL_keycode.h:147
SDLK_CARET
Definition: SDL_keycode.h:94
SDL_MouseWheelEvent
Mouse wheel event structure (event.wheel.*)
Definition: SDL_events.h:251
SDLK_KP_B
Definition: SDL_keycode.h:233
SDLK_KP_ENTER
Definition: SDL_keycode.h:158
SDLK_DOWN
Definition: SDL_keycode.h:150
SDL_WindowEvent
Window state change event data (event.window.*)
Definition: SDL_events.h:160
SDLK_KP_DECIMAL
Definition: SDL_keycode.h:269
SDLK_SPACE
Definition: SDL_keycode.h:55
Zeni::get_Window
Window & get_Window()
Get access to the singleton.
Definition: Window.cpp:392
SDLK_F11
Definition: SDL_keycode.h:136
SDLK_KP_8
Definition: SDL_keycode.h:166
SDLK_KP_A
Definition: SDL_keycode.h:232
SDLK_KP_MINUS
Definition: SDL_keycode.h:156
SDLK_r
Definition: SDL_keycode.h:114
SDL_Keysym::mod
Uint16 mod
Definition: SDL_keyboard.h:51
SDLK_KP_0
Definition: SDL_keycode.h:168
SDLK_MODE
Definition: SDL_keycode.h:282
SDLK_LEFTPAREN
Definition: SDL_keycode.h:63
SDLK_LCTRL
Definition: SDL_keycode.h:273
SDLK_w
Definition: SDL_keycode.h:119
SDLK_KP_MEMRECALL
Definition: SDL_keycode.h:256
SDLK_UP
Definition: SDL_keycode.h:151
SDLK_9
Definition: SDL_keycode.h:80
SDL_Event::syswm
SDL_SysWMEvent syswm
Definition: SDL_events.h:516
SDL_MOUSEMOTION
Definition: SDL_events.h:99
SDLK_QUOTEDBL
Definition: SDL_keycode.h:57
SDLK_F10
Definition: SDL_keycode.h:135
SDLK_KP_HEXADECIMAL
Definition: SDL_keycode.h:270
SDL_MouseMotionEvent
Mouse motion event structure (event.motion.*)
Definition: SDL_events.h:218
SDLK_RGUI
Definition: SDL_keycode.h:280
SDLK_KP_C
Definition: SDL_keycode.h:234
SDLK_BRIGHTNESSDOWN
Definition: SDL_keycode.h:302
SDLK_RALT
Definition: SDL_keycode.h:279
SDLK_KP_GREATER
Definition: SDL_keycode.h:242
SDL_ControllerButtonEvent
Game controller button event structure (event.cbutton.*)
Definition: SDL_events.h:358
SDL_Event::key
SDL_KeyboardEvent key
Definition: SDL_events.h:500
SDLK_HASH
Definition: SDL_keycode.h:58
SDL_Event::cbutton
SDL_ControllerButtonEvent cbutton
Definition: SDL_events.h:512
SDLK_KP_CLEAR
Definition: SDL_keycode.h:265
SDLK_KP_XOR
Definition: SDL_keycode.h:238
SDL_MouseButtonEvent
Mouse button event structure (event.button.*)
Definition: SDL_events.h:234
SDLK_KP_MEMDIVIDE
Definition: SDL_keycode.h:263
SDLK_MEDIASELECT
Definition: SDL_keycode.h:289
SDLK_CALCULATOR
Definition: SDL_keycode.h:292
SDLK_KP_RIGHTPAREN
Definition: SDL_keycode.h:227
SDL_SysWMEvent
A video driver dependent system event (event.syswm.*) This event is disabled by default, you can enable it with SDL_EventState()
Definition: SDL_events.h:485
Zeni::Gamestate_Base::on_active
virtual void on_active(const SDL_ActiveEvent &event)
Override this input callback in your Gamestates. See SDL documentation for details.
Definition: Gamestate.cpp:143
SDLK_SCROLLLOCK
Definition: SDL_keycode.h:140
SDLK_AC_HOME
Definition: SDL_keycode.h:295
Zeni::Gamestate_Base::on_user_event
virtual void on_user_event(const SDL_UserEvent &event)
Override this input callback in your Gamestates. See SDL documentation for details.
Definition: Gamestate.cpp:181
SDLK_QUOTE
Definition: SDL_keycode.h:62
SDL_Keysym::sym
SDL_Keycode sym
Definition: SDL_keyboard.h:50
SDLK_AC_STOP
Definition: SDL_keycode.h:298
SDLK_q
Definition: SDL_keycode.h:113
SDLK_COPY
Definition: SDL_keycode.h:194
SDLK_WWW
Definition: SDL_keycode.h:290
SDLK_F22
Definition: SDL_keycode.h:183
SDLK_KP_F
Definition: SDL_keycode.h:237
SDLK_F19
Definition: SDL_keycode.h:180
SDL_Event::button
SDL_MouseButtonEvent button
Definition: SDL_events.h:504
SDLK_5
Definition: SDL_keycode.h:76
SDLK_F20
Definition: SDL_keycode.h:181
SDLK_CURRENCYUNIT
Definition: SDL_keycode.h:223
SDLK_PAGEUP
Definition: SDL_keycode.h:144
SDLK_LEFTBRACKET
Definition: SDL_keycode.h:91
SDLK_v
Definition: SDL_keycode.h:118
SDLK_F5
Definition: SDL_keycode.h:130
SDL_Event
General event structure.
Definition: SDL_events.h:495
Zeni::Gamestate_Base::on_push
virtual void on_push()
Called when the Gamestate is pushed onto the stack in Game.
Definition: Gamestate.cpp:1101
SDLK_KP_E
Definition: SDL_keycode.h:236
SDL_WINDOWEVENT_RESIZED
Definition: SDL_video.h:144
SDL_Event::user
SDL_UserEvent user
Definition: SDL_events.h:515
SDLK_MENU
Definition: SDL_keycode.h:188
SDLK_LESS
Definition: SDL_keycode.h:83
Zeni::get_Video
Video & get_Video()
Get access to the singleton.
Definition: Video.cpp:149
SDLK_AUDIOMUTE
Definition: SDL_keycode.h:288
SDLK_THOUSANDSSEPARATOR
Definition: SDL_keycode.h:219
SDLK_F4
Definition: SDL_keycode.h:129
SDLK_EXECUTE
Definition: SDL_keycode.h:186
SDLK_F7
Definition: SDL_keycode.h:132
SDL_PRESSED
#define SDL_PRESSED
Definition: SDL_events.h:50
SDLK_UNDERSCORE
Definition: SDL_keycode.h:95
SDLK_NUMLOCKCLEAR
Definition: SDL_keycode.h:153
SDLK_AC_SEARCH
Definition: SDL_keycode.h:294
SDLK_x
Definition: SDL_keycode.h:120
SDLK_p
Definition: SDL_keycode.h:112
SDL_WindowEvent::data1
Sint32 data1
Definition: SDL_events.h:169
SDLK_BRIGHTNESSUP
Definition: SDL_keycode.h:304
Zeni::Gamestate_Base::on_mouse_button
virtual void on_mouse_button(const SDL_MouseButtonEvent &event)
Override this input callback in your Gamestates. See SDL documentation for details.
Definition: Gamestate.cpp:107
SDLK_TAB
Definition: SDL_keycode.h:54
SDLK_KP_MEMMULTIPLY
Definition: SDL_keycode.h:261
SDLK_RIGHT
Definition: SDL_keycode.h:148
SDLK_RIGHTPAREN
Definition: SDL_keycode.h:64
Zeni::Gamestate_Base::on_cover
virtual void on_cover()
Called when a Gamestate is pushed on top of this Gamestate in Game.
Definition: Gamestate.cpp:1104
SDL_CONTROLLERAXISMOTION
Definition: SDL_events.h:114
Zeni::Gamestate_Base::on_video_resize
virtual void on_video_resize(const SDL_ResizeEvent &event)
Override this input callback in your Gamestates. See SDL documentation for details.
Definition: Gamestate.cpp:170
SDLK_KBDILLUMUP
Definition: SDL_keycode.h:309
Zeni::Point2f
A 2D Point represented with floats.
Definition: Coordinate.h:98
SDLK_t
Definition: SDL_keycode.h:116
Zeni::Window
The Window Management Singleton.
Definition: Window.h:53
SDLK_KP_9
Definition: SDL_keycode.h:167
Zeni::Game::push_Popup_Menu_State
void push_Popup_Menu_State()
Definition: Game.cpp:547
SDLK_KP_1
Definition: SDL_keycode.h:159
SDLK_POWER
Definition: SDL_keycode.h:172
SDLK_SEPARATOR
Definition: SDL_keycode.h:210
SDLK_APPLICATION
Definition: SDL_keycode.h:171
SDLK_INSERT
Definition: SDL_keycode.h:142
Zeni::Color
Color.
Definition: Color.h:41
SDL_Event::type
Uint32 type
Definition: SDL_events.h:497
event
cl_event event
Definition: glew.h:3556
SDLK_F14
Definition: SDL_keycode.h:175
SDLK_b
Definition: SDL_keycode.h:98
SDLK_y
Definition: SDL_keycode.h:121
SDLK_PAUSE
Definition: SDL_keycode.h:141
Zeni::Point2i
A 2D Point represented with integers.
Definition: Coordinate.h:85