zenilib: zenilib/jni/external/sdl/src/test/SDL_test_common.c 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
SDL_test_common.c
Go to the documentation of this file.
1 /*
2 Simple DirectMedia Layer
3 Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
4
5 This software is provided 'as-is', without any express or implied
6 warranty. In no event will the authors be held liable for any damages
7 arising from the use of this software.
8
9 Permission is granted to anyone to use this software for any purpose,
10 including commercial applications, and to alter it and redistribute it
11 freely, subject to the following restrictions:
12
13 1. The origin of this software must not be misrepresented; you must not
14 claim that you wrote the original software. If you use this software
15 in a product, an acknowledgment in the product documentation would be
16 appreciated but is not required.
17 2. Altered source versions must be plainly marked as such, and must not be
18 misrepresented as being the original software.
19 3. This notice may not be removed or altered from any source distribution.
20 */
21
22 /* Ported from original test\common.c file. */
23
24 #include "SDL_config.h"
25 #include "SDL_test.h"
26
27 #include <stdio.h>
28
29 #define VIDEO_USAGE \
30 "[--video driver] [--renderer driver] [--gldebug] [--info all|video|modes|render|event] [--log all|error|system|audio|video|render|input] [--display N] [--fullscreen | --fullscreen-desktop | --windows N] [--title title] [--icon icon.bmp] [--center | --position X,Y] [--geometry WxH] [--min-geometry WxH] [--max-geometry WxH] [--logical WxH] [--scale N] [--depth N] [--refresh R] [--vsync] [--noframe] [--resize] [--minimize] [--maximize] [--grab] [--allow-hidpi]"
31
32 #define AUDIO_USAGE \
33 "[--rate N] [--format U8|S8|U16|U16LE|U16BE|S16|S16LE|S16BE] [--channels N] [--samples N]"
34
35 SDLTest_CommonState *
36 SDLTest_CommonCreateState(char **argv, Uint32 flags)
37 {
38 SDLTest_CommonState *state = (SDLTest_CommonState *)SDL_calloc(1, sizeof(*state));
39 if (!state) {
40 SDL_OutOfMemory();
41 return NULL;
42 }
43
44 /* Initialize some defaults */
45 state->argv = argv;
46 state->flags = flags;
47 state->window_title = argv[0];
48 state->window_flags = 0;
49 state->window_x = SDL_WINDOWPOS_UNDEFINED;
50 state->window_y = SDL_WINDOWPOS_UNDEFINED;
51 state->window_w = DEFAULT_WINDOW_WIDTH;
52 state->window_h = DEFAULT_WINDOW_HEIGHT;
53 state->num_windows = 1;
54 state->audiospec.freq = 22050;
55 state->audiospec.format = AUDIO_S16;
56 state->audiospec.channels = 2;
57 state->audiospec.samples = 2048;
58
59 /* Set some very sane GL defaults */
60 state->gl_red_size = 3;
61 state->gl_green_size = 3;
62 state->gl_blue_size = 2;
63 state->gl_alpha_size = 0;
64 state->gl_buffer_size = 0;
65 state->gl_depth_size = 16;
66 state->gl_stencil_size = 0;
67 state->gl_double_buffer = 1;
68 state->gl_accum_red_size = 0;
69 state->gl_accum_green_size = 0;
70 state->gl_accum_blue_size = 0;
71 state->gl_accum_alpha_size = 0;
72 state->gl_stereo = 0;
73 state->gl_multisamplebuffers = 0;
74 state->gl_multisamplesamples = 0;
75 state->gl_retained_backing = 1;
76 state->gl_accelerated = -1;
77 state->gl_debug = 0;
78
79 return state;
80 }
81
82 int
83 SDLTest_CommonArg(SDLTest_CommonState * state, int index)
84 {
85 char **argv = state->argv;
86
87 if (SDL_strcasecmp(argv[index], "--video") == 0) {
88 ++index;
89 if (!argv[index]) {
90 return -1;
91 }
92 state->videodriver = argv[index];
93 return 2;
94 }
95 if (SDL_strcasecmp(argv[index], "--renderer") == 0) {
96 ++index;
97 if (!argv[index]) {
98 return -1;
99 }
100 state->renderdriver = argv[index];
101 return 2;
102 }
103 if (SDL_strcasecmp(argv[index], "--gldebug") == 0) {
104 state->gl_debug = 1;
105 return 1;
106 }
107 if (SDL_strcasecmp(argv[index], "--info") == 0) {
108 ++index;
109 if (!argv[index]) {
110 return -1;
111 }
112 if (SDL_strcasecmp(argv[index], "all") == 0) {
113 state->verbose |=
114 (VERBOSE_VIDEO | VERBOSE_MODES | VERBOSE_RENDER |
115 VERBOSE_EVENT);
116 return 2;
117 }
118 if (SDL_strcasecmp(argv[index], "video") == 0) {
119 state->verbose |= VERBOSE_VIDEO;
120 return 2;
121 }
122 if (SDL_strcasecmp(argv[index], "modes") == 0) {
123 state->verbose |= VERBOSE_MODES;
124 return 2;
125 }
126 if (SDL_strcasecmp(argv[index], "render") == 0) {
127 state->verbose |= VERBOSE_RENDER;
128 return 2;
129 }
130 if (SDL_strcasecmp(argv[index], "event") == 0) {
131 state->verbose |= VERBOSE_EVENT;
132 return 2;
133 }
134 return -1;
135 }
136 if (SDL_strcasecmp(argv[index], "--log") == 0) {
137 ++index;
138 if (!argv[index]) {
139 return -1;
140 }
141 if (SDL_strcasecmp(argv[index], "all") == 0) {
142 SDL_LogSetAllPriority(SDL_LOG_PRIORITY_VERBOSE);
143 return 2;
144 }
145 if (SDL_strcasecmp(argv[index], "error") == 0) {
146 SDL_LogSetPriority(SDL_LOG_CATEGORY_ERROR, SDL_LOG_PRIORITY_VERBOSE);
147 return 2;
148 }
149 if (SDL_strcasecmp(argv[index], "system") == 0) {
150 SDL_LogSetPriority(SDL_LOG_CATEGORY_SYSTEM, SDL_LOG_PRIORITY_VERBOSE);
151 return 2;
152 }
153 if (SDL_strcasecmp(argv[index], "audio") == 0) {
154 SDL_LogSetPriority(SDL_LOG_CATEGORY_AUDIO, SDL_LOG_PRIORITY_VERBOSE);
155 return 2;
156 }
157 if (SDL_strcasecmp(argv[index], "video") == 0) {
158 SDL_LogSetPriority(SDL_LOG_CATEGORY_VIDEO, SDL_LOG_PRIORITY_VERBOSE);
159 return 2;
160 }
161 if (SDL_strcasecmp(argv[index], "render") == 0) {
162 SDL_LogSetPriority(SDL_LOG_CATEGORY_RENDER, SDL_LOG_PRIORITY_VERBOSE);
163 return 2;
164 }
165 if (SDL_strcasecmp(argv[index], "input") == 0) {
166 SDL_LogSetPriority(SDL_LOG_CATEGORY_INPUT, SDL_LOG_PRIORITY_VERBOSE);
167 return 2;
168 }
169 return -1;
170 }
171 if (SDL_strcasecmp(argv[index], "--display") == 0) {
172 ++index;
173 if (!argv[index]) {
174 return -1;
175 }
176 state->display = SDL_atoi(argv[index]);
177 if (SDL_WINDOWPOS_ISUNDEFINED(state->window_x)) {
178 state->window_x = SDL_WINDOWPOS_UNDEFINED_DISPLAY(state->display);
179 state->window_y = SDL_WINDOWPOS_UNDEFINED_DISPLAY(state->display);
180 }
181 if (SDL_WINDOWPOS_ISCENTERED(state->window_x)) {
182 state->window_x = SDL_WINDOWPOS_CENTERED_DISPLAY(state->display);
183 state->window_y = SDL_WINDOWPOS_CENTERED_DISPLAY(state->display);
184 }
185 return 2;
186 }
187 if (SDL_strcasecmp(argv[index], "--fullscreen") == 0) {
188 state->window_flags |= SDL_WINDOW_FULLSCREEN;
189 state->num_windows = 1;
190 return 1;
191 }
192 if (SDL_strcasecmp(argv[index], "--fullscreen-desktop") == 0) {
193 state->window_flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
194 state->num_windows = 1;
195 return 1;
196 }
197 if (SDL_strcasecmp(argv[index], "--allow-highdpi") == 0) {
198 state->window_flags |= SDL_WINDOW_ALLOW_HIGHDPI;
199 return 1;
200 }
201 if (SDL_strcasecmp(argv[index], "--windows") == 0) {
202 ++index;
203 if (!argv[index] || !SDL_isdigit(*argv[index])) {
204 return -1;
205 }
206 if (!(state->window_flags & SDL_WINDOW_FULLSCREEN)) {
207 state->num_windows = SDL_atoi(argv[index]);
208 }
209 return 2;
210 }
211 if (SDL_strcasecmp(argv[index], "--title") == 0) {
212 ++index;
213 if (!argv[index]) {
214 return -1;
215 }
216 state->window_title = argv[index];
217 return 2;
218 }
219 if (SDL_strcasecmp(argv[index], "--icon") == 0) {
220 ++index;
221 if (!argv[index]) {
222 return -1;
223 }
224 state->window_icon = argv[index];
225 return 2;
226 }
227 if (SDL_strcasecmp(argv[index], "--center") == 0) {
228 state->window_x = SDL_WINDOWPOS_CENTERED;
229 state->window_y = SDL_WINDOWPOS_CENTERED;
230 return 1;
231 }
232 if (SDL_strcasecmp(argv[index], "--position") == 0) {
233 char *x, *y;
234 ++index;
235 if (!argv[index]) {
236 return -1;
237 }
238 x = argv[index];
239 y = argv[index];
240 while (*y && *y != ',') {
241 ++y;
242 }
243 if (!*y) {
244 return -1;
245 }
246 *y++ = '\0';
247 state->window_x = SDL_atoi(x);
248 state->window_y = SDL_atoi(y);
249 return 2;
250 }
251 if (SDL_strcasecmp(argv[index], "--geometry") == 0) {
252 char *w, *h;
253 ++index;
254 if (!argv[index]) {
255 return -1;
256 }
257 w = argv[index];
258 h = argv[index];
259 while (*h && *h != 'x') {
260 ++h;
261 }
262 if (!*h) {
263 return -1;
264 }
265 *h++ = '\0';
266 state->window_w = SDL_atoi(w);
267 state->window_h = SDL_atoi(h);
268 return 2;
269 }
270 if (SDL_strcasecmp(argv[index], "--min-geometry") == 0) {
271 char *w, *h;
272 ++index;
273 if (!argv[index]) {
274 return -1;
275 }
276 w = argv[index];
277 h = argv[index];
278 while (*h && *h != 'x') {
279 ++h;
280 }
281 if (!*h) {
282 return -1;
283 }
284 *h++ = '\0';
285 state->window_minW = SDL_atoi(w);
286 state->window_minH = SDL_atoi(h);
287 return 2;
288 }
289 if (SDL_strcasecmp(argv[index], "--max-geometry") == 0) {
290 char *w, *h;
291 ++index;
292 if (!argv[index]) {
293 return -1;
294 }
295 w = argv[index];
296 h = argv[index];
297 while (*h && *h != 'x') {
298 ++h;
299 }
300 if (!*h) {
301 return -1;
302 }
303 *h++ = '\0';
304 state->window_maxW = SDL_atoi(w);
305 state->window_maxH = SDL_atoi(h);
306 return 2;
307 }
308 if (SDL_strcasecmp(argv[index], "--logical") == 0) {
309 char *w, *h;
310 ++index;
311 if (!argv[index]) {
312 return -1;
313 }
314 w = argv[index];
315 h = argv[index];
316 while (*h && *h != 'x') {
317 ++h;
318 }
319 if (!*h) {
320 return -1;
321 }
322 *h++ = '\0';
323 state->logical_w = SDL_atoi(w);
324 state->logical_h = SDL_atoi(h);
325 return 2;
326 }
327 if (SDL_strcasecmp(argv[index], "--scale") == 0) {
328 ++index;
329 if (!argv[index]) {
330 return -1;
331 }
332 state->scale = (float)SDL_atof(argv[index]);
333 return 2;
334 }
335 if (SDL_strcasecmp(argv[index], "--depth") == 0) {
336 ++index;
337 if (!argv[index]) {
338 return -1;
339 }
340 state->depth = SDL_atoi(argv[index]);
341 return 2;
342 }
343 if (SDL_strcasecmp(argv[index], "--refresh") == 0) {
344 ++index;
345 if (!argv[index]) {
346 return -1;
347 }
348 state->refresh_rate = SDL_atoi(argv[index]);
349 return 2;
350 }
351 if (SDL_strcasecmp(argv[index], "--vsync") == 0) {
352 state->render_flags |= SDL_RENDERER_PRESENTVSYNC;
353 return 1;
354 }
355 if (SDL_strcasecmp(argv[index], "--noframe") == 0) {
356 state->window_flags |= SDL_WINDOW_BORDERLESS;
357 return 1;
358 }
359 if (SDL_strcasecmp(argv[index], "--resize") == 0) {
360 state->window_flags |= SDL_WINDOW_RESIZABLE;
361 return 1;
362 }
363 if (SDL_strcasecmp(argv[index], "--minimize") == 0) {
364 state->window_flags |= SDL_WINDOW_MINIMIZED;
365 return 1;
366 }
367 if (SDL_strcasecmp(argv[index], "--maximize") == 0) {
368 state->window_flags |= SDL_WINDOW_MAXIMIZED;
369 return 1;
370 }
371 if (SDL_strcasecmp(argv[index], "--grab") == 0) {
372 state->window_flags |= SDL_WINDOW_INPUT_GRABBED;
373 return 1;
374 }
375 if (SDL_strcasecmp(argv[index], "--rate") == 0) {
376 ++index;
377 if (!argv[index]) {
378 return -1;
379 }
380 state->audiospec.freq = SDL_atoi(argv[index]);
381 return 2;
382 }
383 if (SDL_strcasecmp(argv[index], "--format") == 0) {
384 ++index;
385 if (!argv[index]) {
386 return -1;
387 }
388 if (SDL_strcasecmp(argv[index], "U8") == 0) {
389 state->audiospec.format = AUDIO_U8;
390 return 2;
391 }
392 if (SDL_strcasecmp(argv[index], "S8") == 0) {
393 state->audiospec.format = AUDIO_S8;
394 return 2;
395 }
396 if (SDL_strcasecmp(argv[index], "U16") == 0) {
397 state->audiospec.format = AUDIO_U16;
398 return 2;
399 }
400 if (SDL_strcasecmp(argv[index], "U16LE") == 0) {
401 state->audiospec.format = AUDIO_U16LSB;
402 return 2;
403 }
404 if (SDL_strcasecmp(argv[index], "U16BE") == 0) {
405 state->audiospec.format = AUDIO_U16MSB;
406 return 2;
407 }
408 if (SDL_strcasecmp(argv[index], "S16") == 0) {
409 state->audiospec.format = AUDIO_S16;
410 return 2;
411 }
412 if (SDL_strcasecmp(argv[index], "S16LE") == 0) {
413 state->audiospec.format = AUDIO_S16LSB;
414 return 2;
415 }
416 if (SDL_strcasecmp(argv[index], "S16BE") == 0) {
417 state->audiospec.format = AUDIO_S16MSB;
418 return 2;
419 }
420 return -1;
421 }
422 if (SDL_strcasecmp(argv[index], "--channels") == 0) {
423 ++index;
424 if (!argv[index]) {
425 return -1;
426 }
427 state->audiospec.channels = (Uint8) SDL_atoi(argv[index]);
428 return 2;
429 }
430 if (SDL_strcasecmp(argv[index], "--samples") == 0) {
431 ++index;
432 if (!argv[index]) {
433 return -1;
434 }
435 state->audiospec.samples = (Uint16) SDL_atoi(argv[index]);
436 return 2;
437 }
438 if ((SDL_strcasecmp(argv[index], "-h") == 0)
439 || (SDL_strcasecmp(argv[index], "--help") == 0)) {
440 /* Print the usage message */
441 return -1;
442 }
443 if (SDL_strcmp(argv[index], "-NSDocumentRevisionsDebugMode") == 0) {
444 /* Debug flag sent by Xcode */
445 return 2;
446 }
447 return 0;
448 }
449
450 const char *
451 SDLTest_CommonUsage(SDLTest_CommonState * state)
452 {
453 switch (state->flags & (SDL_INIT_VIDEO | SDL_INIT_AUDIO)) {
454 case SDL_INIT_VIDEO:
455 return VIDEO_USAGE;
456 case SDL_INIT_AUDIO:
457 return AUDIO_USAGE;
458 case (SDL_INIT_VIDEO | SDL_INIT_AUDIO):
459 return VIDEO_USAGE " " AUDIO_USAGE;
460 default:
461 return "";
462 }
463 }
464
465 static void
466 SDLTest_PrintRendererFlag(Uint32 flag)
467 {
468 switch (flag) {
469 case SDL_RENDERER_PRESENTVSYNC:
470 fprintf(stderr, "PresentVSync");
471 break;
472 case SDL_RENDERER_ACCELERATED:
473 fprintf(stderr, "Accelerated");
474 break;
475 default:
476 fprintf(stderr, "0x%8.8x", flag);
477 break;
478 }
479 }
480
481 static void
482 SDLTest_PrintPixelFormat(Uint32 format)
483 {
484 switch (format) {
485 case SDL_PIXELFORMAT_UNKNOWN:
486 fprintf(stderr, "Unknwon");
487 break;
488 case SDL_PIXELFORMAT_INDEX1LSB:
489 fprintf(stderr, "Index1LSB");
490 break;
491 case SDL_PIXELFORMAT_INDEX1MSB:
492 fprintf(stderr, "Index1MSB");
493 break;
494 case SDL_PIXELFORMAT_INDEX4LSB:
495 fprintf(stderr, "Index4LSB");
496 break;
497 case SDL_PIXELFORMAT_INDEX4MSB:
498 fprintf(stderr, "Index4MSB");
499 break;
500 case SDL_PIXELFORMAT_INDEX8:
501 fprintf(stderr, "Index8");
502 break;
503 case SDL_PIXELFORMAT_RGB332:
504 fprintf(stderr, "RGB332");
505 break;
506 case SDL_PIXELFORMAT_RGB444:
507 fprintf(stderr, "RGB444");
508 break;
509 case SDL_PIXELFORMAT_RGB555:
510 fprintf(stderr, "RGB555");
511 break;
512 case SDL_PIXELFORMAT_BGR555:
513 fprintf(stderr, "BGR555");
514 break;
515 case SDL_PIXELFORMAT_ARGB4444:
516 fprintf(stderr, "ARGB4444");
517 break;
518 case SDL_PIXELFORMAT_ABGR4444:
519 fprintf(stderr, "ABGR4444");
520 break;
521 case SDL_PIXELFORMAT_ARGB1555:
522 fprintf(stderr, "ARGB1555");
523 break;
524 case SDL_PIXELFORMAT_ABGR1555:
525 fprintf(stderr, "ABGR1555");
526 break;
527 case SDL_PIXELFORMAT_RGB565:
528 fprintf(stderr, "RGB565");
529 break;
530 case SDL_PIXELFORMAT_BGR565:
531 fprintf(stderr, "BGR565");
532 break;
533 case SDL_PIXELFORMAT_RGB24:
534 fprintf(stderr, "RGB24");
535 break;
536 case SDL_PIXELFORMAT_BGR24:
537 fprintf(stderr, "BGR24");
538 break;
539 case SDL_PIXELFORMAT_RGB888:
540 fprintf(stderr, "RGB888");
541 break;
542 case SDL_PIXELFORMAT_BGR888:
543 fprintf(stderr, "BGR888");
544 break;
545 case SDL_PIXELFORMAT_ARGB8888:
546 fprintf(stderr, "ARGB8888");
547 break;
548 case SDL_PIXELFORMAT_RGBA8888:
549 fprintf(stderr, "RGBA8888");
550 break;
551 case SDL_PIXELFORMAT_ABGR8888:
552 fprintf(stderr, "ABGR8888");
553 break;
554 case SDL_PIXELFORMAT_BGRA8888:
555 fprintf(stderr, "BGRA8888");
556 break;
557 case SDL_PIXELFORMAT_ARGB2101010:
558 fprintf(stderr, "ARGB2101010");
559 break;
560 case SDL_PIXELFORMAT_YV12:
561 fprintf(stderr, "YV12");
562 break;
563 case SDL_PIXELFORMAT_IYUV:
564 fprintf(stderr, "IYUV");
565 break;
566 case SDL_PIXELFORMAT_YUY2:
567 fprintf(stderr, "YUY2");
568 break;
569 case SDL_PIXELFORMAT_UYVY:
570 fprintf(stderr, "UYVY");
571 break;
572 case SDL_PIXELFORMAT_YVYU:
573 fprintf(stderr, "YVYU");
574 break;
575 default:
576 fprintf(stderr, "0x%8.8x", format);
577 break;
578 }
579 }
580
581 static void
582 SDLTest_PrintRenderer(SDL_RendererInfo * info)
583 {
584 int i, count;
585
586 fprintf(stderr, " Renderer %s:\n", info->name);
587
588 fprintf(stderr, " Flags: 0x%8.8X", info->flags);
589 fprintf(stderr, " (");
590 count = 0;
591 for (i = 0; i < sizeof(info->flags) * 8; ++i) {
592 Uint32 flag = (1 << i);
593 if (info->flags & flag) {
594 if (count > 0) {
595 fprintf(stderr, " | ");
596 }
597 SDLTest_PrintRendererFlag(flag);
598 ++count;
599 }
600 }
601 fprintf(stderr, ")\n");
602
603 fprintf(stderr, " Texture formats (%d): ", info->num_texture_formats);
604 for (i = 0; i < (int) info->num_texture_formats; ++i) {
605 if (i > 0) {
606 fprintf(stderr, ", ");
607 }
608 SDLTest_PrintPixelFormat(info->texture_formats[i]);
609 }
610 fprintf(stderr, "\n");
611
612 if (info->max_texture_width || info->max_texture_height) {
613 fprintf(stderr, " Max Texture Size: %dx%d\n",
614 info->max_texture_width, info->max_texture_height);
615 }
616 }
617
618 static SDL_Surface *
619 SDLTest_LoadIcon(const char *file)
620 {
621 SDL_Surface *icon;
622
623 /* Load the icon surface */
624 icon = SDL_LoadBMP(file);
625 if (icon == NULL) {
626 fprintf(stderr, "Couldn't load %s: %s\n", file, SDL_GetError());
627 return (NULL);
628 }
629
630 if (icon->format->palette) {
631 /* Set the colorkey */
632 SDL_SetColorKey(icon, 1, *((Uint8 *) icon->pixels));
633 }
634
635 return (icon);
636 }
637
638 SDL_bool
639 SDLTest_CommonInit(SDLTest_CommonState * state)
640 {
641 int i, j, m, n, w, h;
642 SDL_DisplayMode fullscreen_mode;
643
644 if (state->flags & SDL_INIT_VIDEO) {
645 if (state->verbose & VERBOSE_VIDEO) {
646 n = SDL_GetNumVideoDrivers();
647 if (n == 0) {
648 fprintf(stderr, "No built-in video drivers\n");
649 } else {
650 fprintf(stderr, "Built-in video drivers:");
651 for (i = 0; i < n; ++i) {
652 if (i > 0) {
653 fprintf(stderr, ",");
654 }
655 fprintf(stderr, " %s", SDL_GetVideoDriver(i));
656 }
657 fprintf(stderr, "\n");
658 }
659 }
660 if (SDL_VideoInit(state->videodriver) < 0) {
661 fprintf(stderr, "Couldn't initialize video driver: %s\n",
662 SDL_GetError());
663 return SDL_FALSE;
664 }
665 if (state->verbose & VERBOSE_VIDEO) {
666 fprintf(stderr, "Video driver: %s\n",
667 SDL_GetCurrentVideoDriver());
668 }
669
670 /* Upload GL settings */
671 SDL_GL_SetAttribute(SDL_GL_RED_SIZE, state->gl_red_size);
672 SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, state->gl_green_size);
673 SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, state->gl_blue_size);
674 SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, state->gl_alpha_size);
675 SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, state->gl_double_buffer);
676 SDL_GL_SetAttribute(SDL_GL_BUFFER_SIZE, state->gl_buffer_size);
677 SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, state->gl_depth_size);
678 SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, state->gl_stencil_size);
679 SDL_GL_SetAttribute(SDL_GL_ACCUM_RED_SIZE, state->gl_accum_red_size);
680 SDL_GL_SetAttribute(SDL_GL_ACCUM_GREEN_SIZE, state->gl_accum_green_size);
681 SDL_GL_SetAttribute(SDL_GL_ACCUM_BLUE_SIZE, state->gl_accum_blue_size);
682 SDL_GL_SetAttribute(SDL_GL_ACCUM_ALPHA_SIZE, state->gl_accum_alpha_size);
683 SDL_GL_SetAttribute(SDL_GL_STEREO, state->gl_stereo);
684 SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, state->gl_multisamplebuffers);
685 SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, state->gl_multisamplesamples);
686 if (state->gl_accelerated >= 0) {
687 SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL,
688 state->gl_accelerated);
689 }
690 SDL_GL_SetAttribute(SDL_GL_RETAINED_BACKING, state->gl_retained_backing);
691 if (state->gl_major_version) {
692 SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, state->gl_major_version);
693 SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, state->gl_minor_version);
694 }
695 if (state->gl_debug) {
696 SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG);
697 }
698
699 if (state->verbose & VERBOSE_MODES) {
700 SDL_Rect bounds;
701 SDL_DisplayMode mode;
702 int bpp;
703 Uint32 Rmask, Gmask, Bmask, Amask;
704 #if SDL_VIDEO_DRIVER_WINDOWS
705 int adapterIndex = 0;
706 #endif
707 n = SDL_GetNumVideoDisplays();
708 fprintf(stderr, "Number of displays: %d\n", n);
709 for (i = 0; i < n; ++i) {
710 fprintf(stderr, "Display %d: %s\n", i, SDL_GetDisplayName(i));
711
712 SDL_zero(bounds);
713 SDL_GetDisplayBounds(i, &bounds);
714 fprintf(stderr, "Bounds: %dx%d at %d,%d\n", bounds.w, bounds.h, bounds.x, bounds.y);
715
716 SDL_GetDesktopDisplayMode(i, &mode);
717 SDL_PixelFormatEnumToMasks(mode.format, &bpp, &Rmask, &Gmask,
718 &Bmask, &Amask);
719 fprintf(stderr,
720 " Current mode: %dx%d@%dHz, %d bits-per-pixel (%s)\n",
721 mode.w, mode.h, mode.refresh_rate, bpp,
722 SDL_GetPixelFormatName(mode.format));
723 if (Rmask || Gmask || Bmask) {
724 fprintf(stderr, " Red Mask = 0x%.8x\n", Rmask);
725 fprintf(stderr, " Green Mask = 0x%.8x\n", Gmask);
726 fprintf(stderr, " Blue Mask = 0x%.8x\n", Bmask);
727 if (Amask)
728 fprintf(stderr, " Alpha Mask = 0x%.8x\n", Amask);
729 }
730
731 /* Print available fullscreen video modes */
732 m = SDL_GetNumDisplayModes(i);
733 if (m == 0) {
734 fprintf(stderr, "No available fullscreen video modes\n");
735 } else {
736 fprintf(stderr, " Fullscreen video modes:\n");
737 for (j = 0; j < m; ++j) {
738 SDL_GetDisplayMode(i, j, &mode);
739 SDL_PixelFormatEnumToMasks(mode.format, &bpp, &Rmask,
740 &Gmask, &Bmask, &Amask);
741 fprintf(stderr,
742 " Mode %d: %dx%d@%dHz, %d bits-per-pixel (%s)\n",
743 j, mode.w, mode.h, mode.refresh_rate, bpp,
744 SDL_GetPixelFormatName(mode.format));
745 if (Rmask || Gmask || Bmask) {
746 fprintf(stderr, " Red Mask = 0x%.8x\n",
747 Rmask);
748 fprintf(stderr, " Green Mask = 0x%.8x\n",
749 Gmask);
750 fprintf(stderr, " Blue Mask = 0x%.8x\n",
751 Bmask);
752 if (Amask)
753 fprintf(stderr,
754 " Alpha Mask = 0x%.8x\n",
755 Amask);
756 }
757 }
758 }
759
760 #if SDL_VIDEO_DRIVER_WINDOWS
761 /* Print the adapter index */
762 adapterIndex = SDL_Direct3D9GetAdapterIndex( i );
763 fprintf( stderr, "Adapter Index: %d", adapterIndex );
764 #endif
765 }
766 }
767
768 if (state->verbose & VERBOSE_RENDER) {
769 SDL_RendererInfo info;
770
771 n = SDL_GetNumRenderDrivers();
772 if (n == 0) {
773 fprintf(stderr, "No built-in render drivers\n");
774 } else {
775 fprintf(stderr, "Built-in render drivers:\n");
776 for (i = 0; i < n; ++i) {
777 SDL_GetRenderDriverInfo(i, &info);
778 SDLTest_PrintRenderer(&info);
779 }
780 }
781 }
782
783 SDL_zero(fullscreen_mode);
784 switch (state->depth) {
785 case 8:
786 fullscreen_mode.format = SDL_PIXELFORMAT_INDEX8;
787 break;
788 case 15:
789 fullscreen_mode.format = SDL_PIXELFORMAT_RGB555;
790 break;
791 case 16:
792 fullscreen_mode.format = SDL_PIXELFORMAT_RGB565;
793 break;
794 case 24:
795 fullscreen_mode.format = SDL_PIXELFORMAT_RGB24;
796 break;
797 default:
798 fullscreen_mode.format = SDL_PIXELFORMAT_RGB888;
799 break;
800 }
801 fullscreen_mode.refresh_rate = state->refresh_rate;
802
803 state->windows =
804 (SDL_Window **) SDL_malloc(state->num_windows *
805 sizeof(*state->windows));
806 state->renderers =
807 (SDL_Renderer **) SDL_malloc(state->num_windows *
808 sizeof(*state->renderers));
809 if (!state->windows || !state->renderers) {
810 fprintf(stderr, "Out of memory!\n");
811 return SDL_FALSE;
812 }
813 for (i = 0; i < state->num_windows; ++i) {
814 char title[1024];
815
816 if (state->num_windows > 1) {
817 SDL_snprintf(title, SDL_arraysize(title), "%s %d",
818 state->window_title, i + 1);
819 } else {
820 SDL_strlcpy(title, state->window_title, SDL_arraysize(title));
821 }
822 state->windows[i] =
823 SDL_CreateWindow(title, state->window_x, state->window_y,
824 state->window_w, state->window_h,
825 state->window_flags);
826 if (!state->windows[i]) {
827 fprintf(stderr, "Couldn't create window: %s\n",
828 SDL_GetError());
829 return SDL_FALSE;
830 }
831 if (state->window_minW || state->window_minH) {
832 SDL_SetWindowMinimumSize(state->windows[i], state->window_minW, state->window_minH);
833 }
834 if (state->window_maxW || state->window_maxH) {
835 SDL_SetWindowMaximumSize(state->windows[i], state->window_maxW, state->window_maxH);
836 }
837 SDL_GetWindowSize(state->windows[i], &w, &h);
838 if (!(state->window_flags & SDL_WINDOW_RESIZABLE) &&
839 (w != state->window_w || h != state->window_h)) {
840 printf("Window requested size %dx%d, got %dx%d\n", state->window_w, state->window_h, w, h);
841 state->window_w = w;
842 state->window_h = h;
843 }
844 if (SDL_SetWindowDisplayMode(state->windows[i], &fullscreen_mode) < 0) {
845 fprintf(stderr, "Can't set up fullscreen display mode: %s\n",
846 SDL_GetError());
847 return SDL_FALSE;
848 }
849
850 if (state->window_icon) {
851 SDL_Surface *icon = SDLTest_LoadIcon(state->window_icon);
852 if (icon) {
853 SDL_SetWindowIcon(state->windows[i], icon);
854 SDL_FreeSurface(icon);
855 }
856 }
857
858 SDL_ShowWindow(state->windows[i]);
859
860 state->renderers[i] = NULL;
861
862 if (!state->skip_renderer
863 && (state->renderdriver
864 || !(state->window_flags & SDL_WINDOW_OPENGL))) {
865 m = -1;
866 if (state->renderdriver) {
867 SDL_RendererInfo info;
868 n = SDL_GetNumRenderDrivers();
869 for (j = 0; j < n; ++j) {
870 SDL_GetRenderDriverInfo(j, &info);
871 if (SDL_strcasecmp(info.name, state->renderdriver) ==
872 0) {
873 m = j;
874 break;
875 }
876 }
877 if (m == n) {
878 fprintf(stderr,
879 "Couldn't find render driver named %s",
880 state->renderdriver);
881 return SDL_FALSE;
882 }
883 }
884 state->renderers[i] = SDL_CreateRenderer(state->windows[i],
885 m, state->render_flags);
886 if (!state->renderers[i]) {
887 fprintf(stderr, "Couldn't create renderer: %s\n",
888 SDL_GetError());
889 return SDL_FALSE;
890 }
891 if (state->logical_w && state->logical_h) {
892 SDL_RenderSetLogicalSize(state->renderers[i], state->logical_w, state->logical_h);
893 } else if (state->scale) {
894 SDL_RenderSetScale(state->renderers[i], state->scale, state->scale);
895 }
896 if (state->verbose & VERBOSE_RENDER) {
897 SDL_RendererInfo info;
898
899 fprintf(stderr, "Current renderer:\n");
900 SDL_GetRendererInfo(state->renderers[i], &info);
901 SDLTest_PrintRenderer(&info);
902 }
903 }
904 }
905 }
906
907 if (state->flags & SDL_INIT_AUDIO) {
908 if (state->verbose & VERBOSE_AUDIO) {
909 n = SDL_GetNumAudioDrivers();
910 if (n == 0) {
911 fprintf(stderr, "No built-in audio drivers\n");
912 } else {
913 fprintf(stderr, "Built-in audio drivers:");
914 for (i = 0; i < n; ++i) {
915 if (i > 0) {
916 fprintf(stderr, ",");
917 }
918 fprintf(stderr, " %s", SDL_GetAudioDriver(i));
919 }
920 fprintf(stderr, "\n");
921 }
922 }
923 if (SDL_AudioInit(state->audiodriver) < 0) {
924 fprintf(stderr, "Couldn't initialize audio driver: %s\n",
925 SDL_GetError());
926 return SDL_FALSE;
927 }
928 if (state->verbose & VERBOSE_VIDEO) {
929 fprintf(stderr, "Audio driver: %s\n",
930 SDL_GetCurrentAudioDriver());
931 }
932
933 if (SDL_OpenAudio(&state->audiospec, NULL) < 0) {
934 fprintf(stderr, "Couldn't open audio: %s\n", SDL_GetError());
935 return SDL_FALSE;
936 }
937 }
938
939 return SDL_TRUE;
940 }
941
942 static void
943 SDLTest_PrintEvent(SDL_Event * event)
944 {
945 if ((event->type == SDL_MOUSEMOTION) || (event->type == SDL_FINGERMOTION)) {
946 /* Mouse and finger motion are really spammy */
947 return;
948 }
949
950 fprintf(stderr, "SDL EVENT: ");
951 switch (event->type) {
952 case SDL_WINDOWEVENT:
953 switch (event->window.event) {
954 case SDL_WINDOWEVENT_SHOWN:
955 fprintf(stderr, "Window %d shown", event->window.windowID);
956 break;
957 case SDL_WINDOWEVENT_HIDDEN:
958 fprintf(stderr, "Window %d hidden", event->window.windowID);
959 break;
960 case SDL_WINDOWEVENT_EXPOSED:
961 fprintf(stderr, "Window %d exposed", event->window.windowID);
962 break;
963 case SDL_WINDOWEVENT_MOVED:
964 fprintf(stderr, "Window %d moved to %d,%d",
965 event->window.windowID, event->window.data1,
966 event->window.data2);
967 break;
968 case SDL_WINDOWEVENT_RESIZED:
969 fprintf(stderr, "Window %d resized to %dx%d",
970 event->window.windowID, event->window.data1,
971 event->window.data2);
972 break;
973 case SDL_WINDOWEVENT_SIZE_CHANGED:
974 fprintf(stderr, "Window %d changed size to %dx%d",
975 event->window.windowID, event->window.data1,
976 event->window.data2);
977 break;
978 case SDL_WINDOWEVENT_MINIMIZED:
979 fprintf(stderr, "Window %d minimized", event->window.windowID);
980 break;
981 case SDL_WINDOWEVENT_MAXIMIZED:
982 fprintf(stderr, "Window %d maximized", event->window.windowID);
983 break;
984 case SDL_WINDOWEVENT_RESTORED:
985 fprintf(stderr, "Window %d restored", event->window.windowID);
986 break;
987 case SDL_WINDOWEVENT_ENTER:
988 fprintf(stderr, "Mouse entered window %d",
989 event->window.windowID);
990 break;
991 case SDL_WINDOWEVENT_LEAVE:
992 fprintf(stderr, "Mouse left window %d", event->window.windowID);
993 break;
994 case SDL_WINDOWEVENT_FOCUS_GAINED:
995 fprintf(stderr, "Window %d gained keyboard focus",
996 event->window.windowID);
997 break;
998 case SDL_WINDOWEVENT_FOCUS_LOST:
999 fprintf(stderr, "Window %d lost keyboard focus",
1000 event->window.windowID);
1001 break;
1002 case SDL_WINDOWEVENT_CLOSE:
1003 fprintf(stderr, "Window %d closed", event->window.windowID);
1004 break;
1005 default:
1006 fprintf(stderr, "Window %d got unknown event %d",
1007 event->window.windowID, event->window.event);
1008 break;
1009 }
1010 break;
1011 case SDL_KEYDOWN:
1012 fprintf(stderr,
1013 "Keyboard: key pressed in window %d: scancode 0x%08X = %s, keycode 0x%08X = %s",
1014 event->key.windowID,
1015 event->key.keysym.scancode,
1016 SDL_GetScancodeName(event->key.keysym.scancode),
1017 event->key.keysym.sym, SDL_GetKeyName(event->key.keysym.sym));
1018 break;
1019 case SDL_KEYUP:
1020 fprintf(stderr,
1021 "Keyboard: key released in window %d: scancode 0x%08X = %s, keycode 0x%08X = %s",
1022 event->key.windowID,
1023 event->key.keysym.scancode,
1024 SDL_GetScancodeName(event->key.keysym.scancode),
1025 event->key.keysym.sym, SDL_GetKeyName(event->key.keysym.sym));
1026 break;
1027 case SDL_TEXTINPUT:
1028 fprintf(stderr, "Keyboard: text input \"%s\" in window %d",
1029 event->text.text, event->text.windowID);
1030 break;
1031 case SDL_MOUSEMOTION:
1032 fprintf(stderr, "Mouse: moved to %d,%d (%d,%d) in window %d",
1033 event->motion.x, event->motion.y,
1034 event->motion.xrel, event->motion.yrel,
1035 event->motion.windowID);
1036 break;
1037 case SDL_MOUSEBUTTONDOWN:
1038 fprintf(stderr, "Mouse: button %d pressed at %d,%d in window %d",
1039 event->button.button, event->button.x, event->button.y,
1040 event->button.windowID);
1041 break;
1042 case SDL_MOUSEBUTTONUP:
1043 fprintf(stderr, "Mouse: button %d released at %d,%d in window %d",
1044 event->button.button, event->button.x, event->button.y,
1045 event->button.windowID);
1046 break;
1047 case SDL_MOUSEWHEEL:
1048 fprintf(stderr,
1049 "Mouse: wheel scrolled %d in x and %d in y in window %d",
1050 event->wheel.x, event->wheel.y, event->wheel.windowID);
1051 break;
1052 case SDL_JOYBALLMOTION:
1053 fprintf(stderr, "Joystick %d: ball %d moved by %d,%d",
1054 event->jball.which, event->jball.ball, event->jball.xrel,
1055 event->jball.yrel);
1056 break;
1057 case SDL_JOYHATMOTION:
1058 fprintf(stderr, "Joystick %d: hat %d moved to ", event->jhat.which,
1059 event->jhat.hat);
1060 switch (event->jhat.value) {
1061 case SDL_HAT_CENTERED:
1062 fprintf(stderr, "CENTER");
1063 break;
1064 case SDL_HAT_UP:
1065 fprintf(stderr, "UP");
1066 break;
1067 case SDL_HAT_RIGHTUP:
1068 fprintf(stderr, "RIGHTUP");
1069 break;
1070 case SDL_HAT_RIGHT:
1071 fprintf(stderr, "RIGHT");
1072 break;
1073 case SDL_HAT_RIGHTDOWN:
1074 fprintf(stderr, "RIGHTDOWN");
1075 break;
1076 case SDL_HAT_DOWN:
1077 fprintf(stderr, "DOWN");
1078 break;
1079 case SDL_HAT_LEFTDOWN:
1080 fprintf(stderr, "LEFTDOWN");
1081 break;
1082 case SDL_HAT_LEFT:
1083 fprintf(stderr, "LEFT");
1084 break;
1085 case SDL_HAT_LEFTUP:
1086 fprintf(stderr, "LEFTUP");
1087 break;
1088 default:
1089 fprintf(stderr, "UNKNOWN");
1090 break;
1091 }
1092 break;
1093 case SDL_JOYBUTTONDOWN:
1094 fprintf(stderr, "Joystick %d: button %d pressed",
1095 event->jbutton.which, event->jbutton.button);
1096 break;
1097 case SDL_JOYBUTTONUP:
1098 fprintf(stderr, "Joystick %d: button %d released",
1099 event->jbutton.which, event->jbutton.button);
1100 break;
1101 case SDL_CLIPBOARDUPDATE:
1102 fprintf(stderr, "Clipboard updated");
1103 break;
1104
1105 case SDL_FINGERDOWN:
1106 case SDL_FINGERUP:
1107 fprintf(stderr, "Finger: %s touch=%lld, finger=%lld, x=%f, y=%f, dx=%f, dy=%f, pressure=%f",
1108 (event->type == SDL_FINGERDOWN) ? "down" : "up",
1109 (long long) event->tfinger.touchId,
1110 (long long) event->tfinger.fingerId,
1111 event->tfinger.x, event->tfinger.y,
1112 event->tfinger.dx, event->tfinger.dy, event->tfinger.pressure);
1113 break;
1114
1115 case SDL_QUIT:
1116 fprintf(stderr, "Quit requested");
1117 break;
1118 case SDL_USEREVENT:
1119 fprintf(stderr, "User event %d", event->user.code);
1120 break;
1121 default:
1122 fprintf(stderr, "Unknown event %d", event->type);
1123 break;
1124 }
1125 fprintf(stderr, "\n");
1126 }
1127
1128 static void
1129 SDLTest_ScreenShot(SDL_Renderer *renderer)
1130 {
1131 SDL_Rect viewport;
1132 SDL_Surface *surface;
1133
1134 if (!renderer) {
1135 return;
1136 }
1137
1138 SDL_RenderGetViewport(renderer, &viewport);
1139 surface = SDL_CreateRGBSurface(0, viewport.w, viewport.h, 24,
1140 #if SDL_BYTEORDER == SDL_LIL_ENDIAN
1141 0x00FF0000, 0x0000FF00, 0x000000FF,
1142 #else
1143 0x000000FF, 0x0000FF00, 0x00FF0000,
1144 #endif
1145 0x00000000);
1146 if (!surface) {
1147 fprintf(stderr, "Couldn't create surface: %s\n", SDL_GetError());
1148 return;
1149 }
1150
1151 if (SDL_RenderReadPixels(renderer, NULL, surface->format->format,
1152 surface->pixels, surface->pitch) < 0) {
1153 fprintf(stderr, "Couldn't read screen: %s\n", SDL_GetError());
1154 return;
1155 }
1156
1157 if (SDL_SaveBMP(surface, "screenshot.bmp") < 0) {
1158 fprintf(stderr, "Couldn't save screenshot.bmp: %s\n", SDL_GetError());
1159 return;
1160 }
1161 }
1162
1163 static void
1164 FullscreenTo(int index, int windowId)
1165 {
1166 Uint32 flags;
1167 struct SDL_Rect rect = { 0, 0, 0, 0 };
1168 SDL_Window *window = SDL_GetWindowFromID(windowId);
1169 if (!window) {
1170 return;
1171 }
1172
1173 SDL_GetDisplayBounds( index, &rect );
1174
1175 flags = SDL_GetWindowFlags(window);
1176 if (flags & SDL_WINDOW_FULLSCREEN) {
1177 SDL_SetWindowFullscreen( window, SDL_FALSE );
1178 SDL_Delay( 15 );
1179 }
1180
1181 SDL_SetWindowPosition( window, rect.x, rect.y );
1182 SDL_SetWindowFullscreen( window, SDL_TRUE );
1183 }
1184
1185 void
1186 SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done)
1187 {
1188 int i;
1189 static SDL_MouseMotionEvent lastEvent;
1190
1191 if (state->verbose & VERBOSE_EVENT) {
1192 SDLTest_PrintEvent(event);
1193 }
1194
1195 switch (event->type) {
1196 case SDL_WINDOWEVENT:
1197 switch (event->window.event) {
1198 case SDL_WINDOWEVENT_CLOSE:
1199 {
1200 SDL_Window *window = SDL_GetWindowFromID(event->window.windowID);
1201 if (window) {
1202 SDL_DestroyWindow(window);
1203 }
1204 }
1205 break;
1206 }
1207 break;
1208 case SDL_KEYDOWN:
1209 switch (event->key.keysym.sym) {
1210 /* Add hotkeys here */
1211 case SDLK_PRINTSCREEN: {
1212 SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
1213 if (window) {
1214 for (i = 0; i < state->num_windows; ++i) {
1215 if (window == state->windows[i]) {
1216 SDLTest_ScreenShot(state->renderers[i]);
1217 }
1218 }
1219 }
1220 }
1221 break;
1222 case SDLK_EQUALS:
1223 if (event->key.keysym.mod & KMOD_CTRL) {
1224 /* Ctrl-+ double the size of the window */
1225 SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
1226 if (window) {
1227 int w, h;
1228 SDL_GetWindowSize(window, &w, &h);
1229 SDL_SetWindowSize(window, w*2, h*2);
1230 }
1231 }
1232 break;
1233 case SDLK_MINUS:
1234 if (event->key.keysym.mod & KMOD_CTRL) {
1235 /* Ctrl-- half the size of the window */
1236 SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
1237 if (window) {
1238 int w, h;
1239 SDL_GetWindowSize(window, &w, &h);
1240 SDL_SetWindowSize(window, w/2, h/2);
1241 }
1242 }
1243 break;
1244 case SDLK_c:
1245 if (event->key.keysym.mod & KMOD_CTRL) {
1246 /* Ctrl-C copy awesome text! */
1247 SDL_SetClipboardText("SDL rocks!\nYou know it!");
1248 printf("Copied text to clipboard\n");
1249 }
1250 if (event->key.keysym.mod & KMOD_ALT) {
1251 /* Alt-C toggle a render clip rectangle */
1252 for (i = 0; i < state->num_windows; ++i) {
1253 int w, h;
1254 if (state->renderers[i]) {
1255 SDL_Rect clip;
1256 SDL_GetWindowSize(state->windows[i], &w, &h);
1257 SDL_RenderGetClipRect(state->renderers[i], &clip);
1258 if (SDL_RectEmpty(&clip)) {
1259 clip.x = w/4;
1260 clip.y = h/4;
1261 clip.w = w/2;
1262 clip.h = h/2;
1263 SDL_RenderSetClipRect(state->renderers[i], &clip);
1264 } else {
1265 SDL_RenderSetClipRect(state->renderers[i], NULL);
1266 }
1267 }
1268 }
1269 }
1270 break;
1271 case SDLK_v:
1272 if (event->key.keysym.mod & KMOD_CTRL) {
1273 /* Ctrl-V paste awesome text! */
1274 char *text = SDL_GetClipboardText();
1275 if (*text) {
1276 printf("Clipboard: %s\n", text);
1277 } else {
1278 printf("Clipboard is empty\n");
1279 }
1280 SDL_free(text);
1281 }
1282 break;
1283 case SDLK_g:
1284 if (event->key.keysym.mod & KMOD_CTRL) {
1285 /* Ctrl-G toggle grab */
1286 SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
1287 if (window) {
1288 SDL_SetWindowGrab(window, !SDL_GetWindowGrab(window) ? SDL_TRUE : SDL_FALSE);
1289 }
1290 }
1291 break;
1292 case SDLK_m:
1293 if (event->key.keysym.mod & KMOD_CTRL) {
1294 /* Ctrl-M maximize */
1295 SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
1296 if (window) {
1297 Uint32 flags = SDL_GetWindowFlags(window);
1298 if (flags & SDL_WINDOW_MAXIMIZED) {
1299 SDL_RestoreWindow(window);
1300 } else {
1301 SDL_MaximizeWindow(window);
1302 }
1303 }
1304 }
1305 break;
1306 case SDLK_r:
1307 if (event->key.keysym.mod & KMOD_CTRL) {
1308 /* Ctrl-R toggle mouse relative mode */
1309 SDL_SetRelativeMouseMode(!SDL_GetRelativeMouseMode() ? SDL_TRUE : SDL_FALSE);
1310 }
1311 break;
1312 case SDLK_z:
1313 if (event->key.keysym.mod & KMOD_CTRL) {
1314 /* Ctrl-Z minimize */
1315 SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
1316 if (window) {
1317 SDL_MinimizeWindow(window);
1318 }
1319 }
1320 break;
1321 case SDLK_RETURN:
1322 if (event->key.keysym.mod & KMOD_CTRL) {
1323 /* Ctrl-Enter toggle fullscreen */
1324 SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
1325 if (window) {
1326 Uint32 flags = SDL_GetWindowFlags(window);
1327 if (flags & SDL_WINDOW_FULLSCREEN) {
1328 SDL_SetWindowFullscreen(window, SDL_FALSE);
1329 } else {
1330 SDL_SetWindowFullscreen(window, SDL_TRUE);
1331 }
1332 }
1333 } else if (event->key.keysym.mod & KMOD_ALT) {
1334 /* Alt-Enter toggle fullscreen desktop */
1335 SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
1336 if (window) {
1337 Uint32 flags = SDL_GetWindowFlags(window);
1338 if (flags & SDL_WINDOW_FULLSCREEN) {
1339 SDL_SetWindowFullscreen(window, SDL_FALSE);
1340 } else {
1341 SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_DESKTOP);
1342 }
1343 }
1344 }
1345 break;
1346 case SDLK_b:
1347 if (event->key.keysym.mod & KMOD_CTRL) {
1348 /* Ctrl-B toggle window border */
1349 SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
1350 if (window) {
1351 const Uint32 flags = SDL_GetWindowFlags(window);
1352 const SDL_bool b = ((flags & SDL_WINDOW_BORDERLESS) != 0) ? SDL_TRUE : SDL_FALSE;
1353 SDL_SetWindowBordered(window, b);
1354 }
1355 }
1356 break;
1357 case SDLK_0:
1358 if (event->key.keysym.mod & KMOD_CTRL) {
1359 SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
1360 SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_INFORMATION, "Test Message", "You're awesome!", window);
1361 }
1362 break;
1363 case SDLK_1:
1364 if (event->key.keysym.mod & KMOD_CTRL) {
1365 FullscreenTo(0, event->key.windowID);
1366 }
1367 break;
1368 case SDLK_2:
1369 if (event->key.keysym.mod & KMOD_CTRL) {
1370 FullscreenTo(1, event->key.windowID);
1371 }
1372 break;
1373 case SDLK_ESCAPE:
1374 *done = 1;
1375 break;
1376 case SDLK_SPACE:
1377 {
1378 char message[256];
1379 SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
1380
1381 SDL_snprintf(message, sizeof(message), "(%i, %i), rel (%i, %i)\n", lastEvent.x, lastEvent.y, lastEvent.xrel, lastEvent.yrel);
1382 SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_INFORMATION, "Last mouse position", message, window);
1383 break;
1384 }
1385 default:
1386 break;
1387 }
1388 break;
1389 case SDL_QUIT:
1390 *done = 1;
1391 break;
1392 case SDL_MOUSEMOTION:
1393 lastEvent = event->motion;
1394 break;
1395 }
1396 }
1397
1398 void
1399 SDLTest_CommonQuit(SDLTest_CommonState * state)
1400 {
1401 int i;
1402
1403 SDL_free(state->windows);
1404 if (state->renderers) {
1405 for (i = 0; i < state->num_windows; ++i) {
1406 if (state->renderers[i]) {
1407 SDL_DestroyRenderer(state->renderers[i]);
1408 }
1409 }
1410 SDL_free(state->renderers);
1411 }
1412 if (state->flags & SDL_INIT_VIDEO) {
1413 SDL_VideoQuit();
1414 }
1415 if (state->flags & SDL_INIT_AUDIO) {
1416 SDL_AudioQuit();
1417 }
1418 SDL_free(state);
1419 }
1420
1421 /* vi: set ts=4 sw=4 expandtab: */
SDL_HAT_LEFTDOWN
#define SDL_HAT_LEFTDOWN
Definition: SDL_joystick.h:199
SDL_WINDOWPOS_ISUNDEFINED
#define SDL_WINDOWPOS_ISUNDEFINED(X)
Definition: SDL_video.h:120
SDL_JOYBUTTONUP
Definition: SDL_events.h:109
SDLTest_CommonState::gl_stereo
int gl_stereo
Definition: SDL_test_common.h:103
SDL_test.h
SDL_LOG_CATEGORY_INPUT
Definition: SDL_log.h:73
SDL_SetWindowMaximumSize
DECLSPEC void SDLCALL SDL_SetWindowMaximumSize(SDL_Window *window, int max_w, int max_h)
Set the maximum size of a window&#39;s client area.
Definition: SDL_video.c:1686
SDL_Event::motion
SDL_MouseMotionEvent motion
Definition: SDL_events.h:503
SDL_RenderGetClipRect
DECLSPEC void SDLCALL SDL_RenderGetClipRect(SDL_Renderer *renderer, SDL_Rect *rect)
Get the clip rectangle for the current target.
Definition: SDL_render.c:1236
SDL_JoyButtonEvent::which
SDL_JoystickID which
Definition: SDL_events.h:320
SDLTest_CommonState::argv
char ** argv
Definition: SDL_test_common.h:54
SDLK_EQUALS
Definition: SDL_keycode.h:84
SDL_JOYHATMOTION
Definition: SDL_events.h:107
SDL_PIXELFORMAT_YV12
Definition: SDL_pixels.h:240
SDL_SetWindowMinimumSize
DECLSPEC void SDLCALL SDL_SetWindowMinimumSize(SDL_Window *window, int min_w, int min_h)
Set the minimum size of a window&#39;s client area.
Definition: SDL_video.c:1650
SDLK_2
Definition: SDL_keycode.h:73
SDL_FreeSurface
DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface *surface)
Definition: SDL_surface.c:1053
SDL_PIXELFORMAT_ABGR4444
Definition: SDL_pixels.h:182
SDLTest_CommonState::gl_minor_version
int gl_minor_version
Definition: SDL_test_common.h:109
SDL_WINDOWPOS_CENTERED
#define SDL_WINDOWPOS_CENTERED
Definition: SDL_video.h:128
SDL_CreateRGBSurface
DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurface(Uint32 flags, int width, int height, int depth, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
Definition: SDL_surface.c:35
SDL_KEYDOWN
Definition: SDL_events.h:93
SDL_PIXELFORMAT_INDEX8
Definition: SDL_pixels.h:162
SDL_GetKeyName
DECLSPEC const char *SDLCALL SDL_GetKeyName(SDL_Keycode key)
Get a human-readable name for a key.
Definition: SDL_keyboard.c:925
SDL_RendererInfo::max_texture_width
int max_texture_width
Definition: SDL_render.h:84
SDL_PIXELFORMAT_ABGR1555
Definition: SDL_pixels.h:194
SDLTest_LoadIcon
static SDL_Surface * SDLTest_LoadIcon(const char *file)
Definition: SDL_test_common.c:619
SDLK_1
Definition: SDL_keycode.h:72
h
GLfloat GLfloat GLfloat GLfloat h
Definition: glew.h:7294
SDL_VideoQuit
DECLSPEC void SDLCALL SDL_VideoQuit(void)
Shuts down the video subsystem.
Definition: SDL_video.c:2265
SDL_GL_STEREO
Definition: SDL_video.h:180
SDLTest_CommonState::gl_accelerated
int gl_accelerated
Definition: SDL_test_common.h:107
SDL_calloc
DECLSPEC void *SDLCALL SDL_calloc(size_t nmemb, size_t size)
SDL_PIXELFORMAT_ABGR8888
Definition: SDL_pixels.h:230
SDL_PIXELFORMAT_BGR24
Definition: SDL_pixels.h:209
SDL_MouseMotionEvent::y
Sint32 y
Definition: SDL_events.h:226
SDL_RENDERER_ACCELERATED
Definition: SDL_render.h:67
message
GLsizei GLenum GLuint GLuint GLsizei GLchar * message
Definition: glew.h:2540
SDL_MOUSEBUTTONUP
Definition: SDL_events.h:101
SDL_GL_CONTEXT_MINOR_VERSION
Definition: SDL_video.h:186
SDL_WINDOWEVENT_MINIMIZED
Definition: SDL_video.h:146
SDL_GL_CONTEXT_MAJOR_VERSION
Definition: SDL_video.h:185
SDLTest_CommonState::skip_renderer
SDL_bool skip_renderer
Definition: SDL_test_common.h:83
SDL_RendererInfo::flags
Uint32 flags
Definition: SDL_render.h:81
SDL_RenderSetScale
DECLSPEC int SDLCALL SDL_RenderSetScale(SDL_Renderer *renderer, float scaleX, float scaleY)
Set the drawing scale for rendering on the current target.
Definition: SDL_render.c:1249
NULL
#define NULL
Definition: ftobjs.h:61
SDL_LoadBMP
#define SDL_LoadBMP(file)
Definition: SDL_surface.h:182
SDL_snprintf
DECLSPEC int SDLCALL SDL_snprintf(char *text, size_t maxlen, const char *fmt,...)
Definition: SDL_string.c:1277
SDL_GL_DOUBLEBUFFER
Definition: SDL_video.h:173
SDL_DisplayMode::w
int w
Definition: SDL_video.h:56
AUDIO_U16LSB
#define AUDIO_U16LSB
Definition: SDL_audio.h:91
SDL_Event::jbutton
SDL_JoyButtonEvent jbutton
Definition: SDL_events.h:509
SDL_MouseButtonEvent::y
Sint32 y
Definition: SDL_events.h:245
SDL_LogSetAllPriority
DECLSPEC void SDLCALL SDL_LogSetAllPriority(SDL_LogPriority priority)
Set the priority of all log categories.
Definition: SDL_log.c:99
SDL_PIXELFORMAT_RGB24
Definition: SDL_pixels.h:206
SDLTest_CommonCreateState
SDLTest_CommonState * SDLTest_CommonCreateState(char **argv, Uint32 flags)
Parse command line parameters and create common state.
Definition: SDL_test_common.c:36
SDL_GetPixelFormatName
DECLSPEC const char *SDLCALL SDL_GetPixelFormatName(Uint32 format)
Get the human readable name of a pixel format.
Definition: SDL_pixels.c:86
SDL_bool
SDL_bool
Definition: SDL_stdinc.h:116
KMOD_CTRL
#define KMOD_CTRL
Definition: SDL_keycode.h:334
SDL_PIXELFORMAT_RGB565
Definition: SDL_pixels.h:200
SDL_JoyBallEvent::ball
Uint8 ball
Definition: SDL_events.h:285
n
GLclampd n
Definition: glew.h:7287
SDL_TouchFingerEvent::dx
float dx
Definition: SDL_events.h:392
SDL_TouchFingerEvent::pressure
float pressure
Definition: SDL_events.h:394
SDL_VideoInit
DECLSPEC int SDLCALL SDL_VideoInit(const char *driver_name)
Initialize the video subsystem, optionally specifying a video driver.
Definition: SDL_video.c:406
SDL_HAT_RIGHTUP
#define SDL_HAT_RIGHTUP
Definition: SDL_joystick.h:196
SDLK_z
Definition: SDL_keycode.h:122
SDL_RENDERER_PRESENTVSYNC
Definition: SDL_render.h:69
SDL_GetWindowGrab
DECLSPEC SDL_bool SDLCALL SDL_GetWindowGrab(SDL_Window *window)
Get a window&#39;s input grab mode.
Definition: SDL_video.c:2037
SDL_TRUE
Definition: SDL_stdinc.h:119
SDL_atof
DECLSPEC double SDLCALL SDL_atof(const char *str)
Definition: SDL_string.c:783
x
EGLSurface EGLint x
Definition: eglext.h:293
surface
EGLSurface surface
Definition: eglext.h:74
SDL_MOUSEBUTTONDOWN
Definition: SDL_events.h:100
SDLTest_CommonArg
int SDLTest_CommonArg(SDLTest_CommonState *state, int index)
Process one common argument.
Definition: SDL_test_common.c:83
SDL_Event::jball
SDL_JoyBallEvent jball
Definition: SDL_events.h:507
SDLTest_CommonState::window_w
int window_w
Definition: SDL_test_common.h:66
SDL_Surface
A collection of pixels used in software blitting.
Definition: SDL_surface.h:69
SDLTest_CommonState::gl_buffer_size
int gl_buffer_size
Definition: SDL_test_common.h:95
SDL_QUIT
Definition: SDL_events.h:60
SDL_PIXELFORMAT_YVYU
Definition: SDL_pixels.h:248
SDL_TouchFingerEvent::touchId
SDL_TouchID touchId
Definition: SDL_events.h:388
SDL_GL_GREEN_SIZE
Definition: SDL_video.h:169
SDLTest_CommonState::window_x
int window_x
Definition: SDL_test_common.h:64
SDL_free
DECLSPEC void SDLCALL SDL_free(void *mem)
SDLTest_CommonState::window_icon
const char * window_icon
Definition: SDL_test_common.h:62
AUDIO_USAGE
#define AUDIO_USAGE
Definition: SDL_test_common.c:32
SDL_LOG_CATEGORY_RENDER
Definition: SDL_log.h:72
SDL_RendererInfo::texture_formats
Uint32 texture_formats[16]
Definition: SDL_render.h:83
SDL_DisplayMode
The structure that defines a display mode.
Definition: SDL_video.h:53
SDL_Renderer
Definition: SDL_sysrender.h:76
j
int32_t j
Definition: e_log.c:102
SDL_USEREVENT
Definition: SDL_events.h:140
SDL_PIXELFORMAT_ARGB4444
Definition: SDL_pixels.h:176
SDL_SetWindowDisplayMode
DECLSPEC int SDLCALL SDL_SetWindowDisplayMode(SDL_Window *window, const SDL_DisplayMode *mode)
Set the display mode used when a fullscreen window is visible.
Definition: SDL_video.c:1007
SDL_PIXELFORMAT_UNKNOWN
Definition: SDL_pixels.h:149
SDL_MouseMotionEvent::x
Sint32 x
Definition: SDL_events.h:225
file
FILE * file
Definition: visualinfo.c:88
SDL_JoyBallEvent::xrel
Sint16 xrel
Definition: SDL_events.h:289
SDLTest_CommonState::verbose
Uint32 verbose
Definition: SDL_test_common.h:56
SDL_WINDOWPOS_ISCENTERED
#define SDL_WINDOWPOS_ISCENTERED(X)
Definition: SDL_video.h:129
SDL_Keysym::scancode
SDL_Scancode scancode
Definition: SDL_keyboard.h:49
SDL_GetNumDisplayModes
DECLSPEC int SDLCALL SDL_GetNumDisplayModes(int displayIndex)
Returns the number of available display modes.
Definition: SDL_video.c:713
SDL_AudioSpec::samples
Uint16 samples
Definition: SDL_audio.h:171
SDL_DisplayMode::refresh_rate
int refresh_rate
Definition: SDL_video.h:58
KMOD_ALT
#define KMOD_ALT
Definition: SDL_keycode.h:336
SDL_WINDOWEVENT_MAXIMIZED
Definition: SDL_video.h:147
SDL_SaveBMP
#define SDL_SaveBMP(surface, file)
Definition: SDL_surface.h:199
SDL_LIL_ENDIAN
#define SDL_LIL_ENDIAN
Definition: SDL_endian.h:37
SDL_GetWindowSize
DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_Window *window, int *w, int *h)
Get the size of a window&#39;s client area.
Definition: SDL_video.c:1638
SDL_JOYBALLMOTION
Definition: SDL_events.h:106
SDL_PIXELFORMAT_INDEX1MSB
Definition: SDL_pixels.h:153
SDLTest_CommonState::renderdriver
const char * renderdriver
Definition: SDL_test_common.h:81
VERBOSE_EVENT
#define VERBOSE_EVENT
Definition: SDL_test_common.h:48
SDL_PIXELFORMAT_RGB444
Definition: SDL_pixels.h:167
SDL_WINDOWPOS_UNDEFINED
#define SDL_WINDOWPOS_UNDEFINED
Definition: SDL_video.h:119
SDL_RenderSetLogicalSize
DECLSPEC int SDLCALL SDL_RenderSetLogicalSize(SDL_Renderer *renderer, int w, int h)
Set device independent resolution for rendering.
Definition: SDL_render.c:1154
SDL_SetWindowSize
DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window *window, int w, int h)
Set the size of a window&#39;s client area.
Definition: SDL_video.c:1611
SDL_GetNumAudioDrivers
DECLSPEC int SDLCALL SDL_GetNumAudioDrivers(void)
Definition: SDL_audio.c:547
SDL_RenderReadPixels
DECLSPEC int SDLCALL SDL_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect, Uint32 format, void *pixels, int pitch)
Read pixels from the current rendering target.
Definition: SDL_render.c:1748
SDL_GetError
DECLSPEC const char *SDLCALL SDL_GetError(void)
Definition: SDL_error.c:204
SDL_MOUSEWHEEL
Definition: SDL_events.h:102
SDL_RendererInfo::name
const char * name
Definition: SDL_render.h:80
SDL_FALSE
Definition: SDL_stdinc.h:118
SDL_GL_ACCUM_BLUE_SIZE
Definition: SDL_video.h:178
SDL_WINDOWEVENT_SIZE_CHANGED
Definition: SDL_video.h:145
SDL_PIXELFORMAT_BGR565
Definition: SDL_pixels.h:203
SDLTest_CommonInit
SDL_bool SDLTest_CommonInit(SDLTest_CommonState *state)
Open test window.
Definition: SDL_test_common.c:639
SDL_CreateRenderer
DECLSPEC SDL_Renderer *SDLCALL SDL_CreateRenderer(SDL_Window *window, int index, Uint32 flags)
Create a 2D rendering context for a window.
Definition: SDL_render.c:204
SDL_RendererInfo::max_texture_height
int max_texture_height
Definition: SDL_render.h:85
SDLK_g
Definition: SDL_keycode.h:103
SDL_LOG_PRIORITY_VERBOSE
Definition: SDL_log.h:104
SDL_RectEmpty
SDL_FORCE_INLINE SDL_bool SDL_RectEmpty(const SDL_Rect *r)
Returns true if the rectangle has no area.
Definition: SDL_rect.h:72
SDL_GL_ACCUM_GREEN_SIZE
Definition: SDL_video.h:177
SDLK_0
Definition: SDL_keycode.h:71
SDL_Event::wheel
SDL_MouseWheelEvent wheel
Definition: SDL_events.h:505
SDLTest_PrintPixelFormat
static void SDLTest_PrintPixelFormat(Uint32 format)
Definition: SDL_test_common.c:482
SDL_config.h
SDL_MESSAGEBOX_INFORMATION
Definition: SDL_messagebox.h:41
SDLTest_CommonState::gl_double_buffer
int gl_double_buffer
Definition: SDL_test_common.h:98
SDLTest_CommonState::window_y
int window_y
Definition: SDL_test_common.h:65
SDL_WINDOWEVENT_HIDDEN
Definition: SDL_video.h:139
SDL_GL_RETAINED_BACKING
Definition: SDL_video.h:184
SDLTest_CommonState::audiospec
SDL_AudioSpec audiospec
Definition: SDL_test_common.h:88
SDL_SetWindowGrab
DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_Window *window, SDL_bool grabbed)
Set a window&#39;s input grab mode.
Definition: SDL_video.c:2021
SDL_KeyboardEvent::windowID
Uint32 windowID
Definition: SDL_events.h:180
SDL_PIXELFORMAT_ARGB2101010
Definition: SDL_pixels.h:236
SDLK_c
Definition: SDL_keycode.h:99
SDL_GL_ACCUM_ALPHA_SIZE
Definition: SDL_video.h:179
SDLTest_CommonState::windows
SDL_Window ** windows
Definition: SDL_test_common.h:78
SDL_SetWindowIcon
DECLSPEC void SDLCALL SDL_SetWindowIcon(SDL_Window *window, SDL_Surface *icon)
Set the icon for a window.
Definition: SDL_video.c:1445
SDLTest_CommonState::scale
float scale
Definition: SDL_test_common.h:74
SDL_TouchFingerEvent::dy
float dy
Definition: SDL_events.h:393
SDL_PIXELFORMAT_RGB332
Definition: SDL_pixels.h:164
SDL_PIXELFORMAT_ARGB1555
Definition: SDL_pixels.h:188
SDLTest_CommonState::flags
Uint32 flags
Definition: SDL_test_common.h:55
SDL_WINDOWEVENT_FOCUS_GAINED
Definition: SDL_video.h:152
SDL_Event::window
SDL_WindowEvent window
Definition: SDL_events.h:499
Uint32
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:145
SDLTest_CommonState::num_windows
int num_windows
Definition: SDL_test_common.h:77
VERBOSE_AUDIO
#define VERBOSE_AUDIO
Definition: SDL_test_common.h:49
SDL_LOG_CATEGORY_AUDIO
Definition: SDL_log.h:70
SDLK_ESCAPE
Definition: SDL_keycode.h:52
SDL_PIXELFORMAT_IYUV
Definition: SDL_pixels.h:242
SDL_MouseMotionEvent::yrel
Sint32 yrel
Definition: SDL_events.h:228
SDLTest_CommonState::window_flags
Uint32 window_flags
Definition: SDL_test_common.h:63
SDL_GL_SetAttribute
DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value)
Set an OpenGL window attribute before window creation.
Definition: SDL_video.c:2469
AUDIO_U8
#define AUDIO_U8
Definition: SDL_audio.h:89
SDL_GL_ACCUM_RED_SIZE
Definition: SDL_video.h:176
SDL_HAT_RIGHT
#define SDL_HAT_RIGHT
Definition: SDL_joystick.h:193
SDL_JoyBallEvent::which
SDL_JoystickID which
Definition: SDL_events.h:284
SDL_MouseButtonEvent::button
Uint8 button
Definition: SDL_events.h:240
SDL_MinimizeWindow
DECLSPEC void SDLCALL SDL_MinimizeWindow(SDL_Window *window)
Minimize a window to an iconic representation.
Definition: SDL_video.c:1783
SDL_FINGERDOWN
Definition: SDL_events.h:122
SDL_GetDisplayName
DECLSPEC const char *SDLCALL SDL_GetDisplayName(int displayIndex)
Get the name of a display in UTF-8 encoding.
Definition: SDL_video.c:630
SDL_GetClipboardText
DECLSPEC char *SDLCALL SDL_GetClipboardText(void)
Get UTF-8 text from the clipboard, which must be freed with SDL_free()
Definition: SDL_clipboard.c:45
SDLK_RETURN
Definition: SDL_keycode.h:51
SDL_Event::text
SDL_TextInputEvent text
Definition: SDL_events.h:502
SDL_GL_MULTISAMPLEBUFFERS
Definition: SDL_video.h:181
SDL_MouseMotionEvent::xrel
Sint32 xrel
Definition: SDL_events.h:227
SDL_TextInputEvent::text
char text[SDL_TEXTINPUTEVENT_TEXT_SIZE]
Definition: SDL_events.h:212
SDL_AudioSpec::freq
int freq
Definition: SDL_audio.h:167
SDLTest_CommonEvent
void SDLTest_CommonEvent(SDLTest_CommonState *state, SDL_Event *event, int *done)
Common event handler for test windows.
Definition: SDL_test_common.c:1186
SDL_HAT_RIGHTDOWN
#define SDL_HAT_RIGHTDOWN
Definition: SDL_joystick.h:197
SDLTest_CommonState::display
int display
Definition: SDL_test_common.h:60
SDLTest_CommonState::gl_retained_backing
int gl_retained_backing
Definition: SDL_test_common.h:106
SDL_GetCurrentAudioDriver
DECLSPEC const char *SDLCALL SDL_GetCurrentAudioDriver(void)
Definition: SDL_audio.c:618
SDLTest_CommonState::gl_multisamplebuffers
int gl_multisamplebuffers
Definition: SDL_test_common.h:104
SDL_WINDOWPOS_UNDEFINED_DISPLAY
#define SDL_WINDOWPOS_UNDEFINED_DISPLAY(X)
Definition: SDL_video.h:118
SDL_PIXELFORMAT_BGR555
Definition: SDL_pixels.h:173
int
int
Definition: SDL_systhread.c:37
SDLTest_PrintRenderer
static void SDLTest_PrintRenderer(SDL_RendererInfo *info)
Definition: SDL_test_common.c:582
SDL_JOYBUTTONDOWN
Definition: SDL_events.h:108
SDL_HAT_LEFT
#define SDL_HAT_LEFT
Definition: SDL_joystick.h:195
SDL_AudioSpec::channels
Uint8 channels
Definition: SDL_audio.h:169
SDLTest_CommonState::gl_depth_size
int gl_depth_size
Definition: SDL_test_common.h:96
SDL_Surface::pixels
void * pixels
Definition: SDL_surface.h:75
SDL_WINDOWEVENT_RESTORED
Definition: SDL_video.h:148
SDL_TouchFingerEvent::x
float x
Definition: SDL_events.h:390
SDL_ShowWindow
DECLSPEC void SDLCALL SDL_ShowWindow(SDL_Window *window)
Show a window.
Definition: SDL_video.c:1722
SDL_GetDesktopDisplayMode
DECLSPEC int SDLCALL SDL_GetDesktopDisplayMode(int displayIndex, SDL_DisplayMode *mode)
Fill in information about the desktop display mode.
Definition: SDL_video.c:739
SDL_PIXELFORMAT_BGRA8888
Definition: SDL_pixels.h:233
SDL_KEYUP
Definition: SDL_events.h:94
SDL_GetDisplayMode
DECLSPEC int SDLCALL SDL_GetDisplayMode(int displayIndex, int modeIndex, SDL_DisplayMode *mode)
Fill in information about a specific display mode.
Definition: SDL_video.c:721
SDL_GetAudioDriver
DECLSPEC const char *SDLCALL SDL_GetAudioDriver(int index)
Definition: SDL_audio.c:553
count
GLint GLsizei count
Definition: gl2ext.h:1011
SDL_GL_ALPHA_SIZE
Definition: SDL_video.h:171
SDL_PIXELFORMAT_INDEX4LSB
Definition: SDL_pixels.h:156
SDL_strlcpy
DECLSPEC size_t SDLCALL SDL_strlcpy(char *dst, const char *src, size_t maxlen)
Definition: SDL_string.c:448
SDLK_PRINTSCREEN
Definition: SDL_keycode.h:139
SDL_RestoreWindow
DECLSPEC void SDLCALL SDL_RestoreWindow(SDL_Window *window)
Restore the size and position of a minimized or maximized window.
Definition: SDL_video.c:1799
SDL_WINDOW_ALLOW_HIGHDPI
Definition: SDL_video.h:111
SDL_LOG_CATEGORY_ERROR
Definition: SDL_log.h:67
SDLK_m
Definition: SDL_keycode.h:109
SDL_GetWindowFromID
DECLSPEC SDL_Window *SDLCALL SDL_GetWindowFromID(Uint32 id)
Get a window from a stored ID, or NULL if it doesn&#39;t exist.
Definition: SDL_video.c:1393
SDL_WindowEvent::data2
Sint32 data2
Definition: SDL_events.h:170
SDLTest_CommonState::window_h
int window_h
Definition: SDL_test_common.h:67
SDLTest_CommonState::refresh_rate
int refresh_rate
Definition: SDL_test_common.h:76
SDL_MouseWheelEvent::windowID
Uint32 windowID
Definition: SDL_events.h:255
SDL_WINDOWEVENT_FOCUS_LOST
Definition: SDL_video.h:153
SDL_Delay
DECLSPEC void SDLCALL SDL_Delay(Uint32 ms)
Wait a specified number of milliseconds before returning.
Definition: SDL_systimer.c:70
SDL_LogSetPriority
DECLSPEC void SDLCALL SDL_LogSetPriority(int category, SDL_LogPriority priority)
Set the priority of a particular log category.
Definition: SDL_log.c:112
VIDEO_USAGE
#define VIDEO_USAGE
Definition: SDL_test_common.c:29
SDLTest_CommonState::depth
int depth
Definition: SDL_test_common.h:75
SDL_WINDOWEVENT
Definition: SDL_events.h:89
SDL_SetWindowFullscreen
DECLSPEC int SDLCALL SDL_SetWindowFullscreen(SDL_Window *window, Uint32 flags)
Set a window&#39;s fullscreen state.
Definition: SDL_video.c:1814
SDLTest_CommonState::window_minH
int window_minH
Definition: SDL_test_common.h:69
SDLTest_CommonState::gl_multisamplesamples
int gl_multisamplesamples
Definition: SDL_test_common.h:105
format
GLint GLenum GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl2ext.h:845
DEFAULT_WINDOW_HEIGHT
#define DEFAULT_WINDOW_HEIGHT
Definition: SDL_test_common.h:42
SDL_LOG_CATEGORY_SYSTEM
Definition: SDL_log.h:69
SDL_GetDisplayBounds
DECLSPEC int SDLCALL SDL_GetDisplayBounds(int displayIndex, SDL_Rect *rect)
Get the desktop area represented by a display, with the primary display located at 0...
Definition: SDL_video.c:638
SDL_malloc
DECLSPEC void *SDLCALL SDL_malloc(size_t size)
index
GLuint index
Definition: glew.h:1800
SDL_DisplayMode::h
int h
Definition: SDL_video.h:57
SDL_WINDOW_MINIMIZED
Definition: SDL_video.h:104
SDL_strcmp
DECLSPEC int SDLCALL SDL_strcmp(const char *str1, const char *str2)
Definition: SDL_string.c:910
SDL_TextInputEvent::windowID
Uint32 windowID
Definition: SDL_events.h:211
SDL_GL_STENCIL_SIZE
Definition: SDL_video.h:175
SDL_GetWindowFlags
DECLSPEC Uint32 SDLCALL SDL_GetWindowFlags(SDL_Window *window)
Get the window flags.
Definition: SDL_video.c:1409
SDL_Rect::x
int x
Definition: SDL_rect.h:65
SDL_WindowEvent::event
Uint8 event
Definition: SDL_events.h:165
SDL_KeyboardEvent::keysym
SDL_Keysym keysym
Definition: SDL_events.h:185
SDL_UserEvent::code
Sint32 code
Definition: SDL_events.h:470
SDL_WINDOWEVENT_LEAVE
Definition: SDL_video.h:151
SDLTest_CommonUsage
const char * SDLTest_CommonUsage(SDLTest_CommonState *state)
Returns common usage information.
Definition: SDL_test_common.c:451
SDLTest_PrintRendererFlag
static void SDLTest_PrintRendererFlag(Uint32 flag)
Definition: SDL_test_common.c:466
SDL_SetWindowBordered
DECLSPEC void SDLCALL SDL_SetWindowBordered(SDL_Window *window, SDL_bool bordered)
Set the border state of a window.
Definition: SDL_video.c:1593
SDL_GL_BLUE_SIZE
Definition: SDL_video.h:170
SDL_FINGERMOTION
Definition: SDL_events.h:124
SDLK_MINUS
Definition: SDL_keycode.h:68
SDL_Rect::w
int w
Definition: SDL_rect.h:66
SDL_GetVideoDriver
DECLSPEC const char *SDLCALL SDL_GetVideoDriver(int index)
Get the name of a built in video driver.
Definition: SDL_video.c:394
SDL_ShowSimpleMessageBox
DECLSPEC int SDLCALL SDL_ShowSimpleMessageBox(Uint32 flags, const char *title, const char *message, SDL_Window *window)
Create a simple modal message box.
Definition: SDL_video.c:3185
SDL_WINDOWEVENT_CLOSE
Definition: SDL_video.h:154
SDLTest_CommonState
Definition: SDL_test_common.h:51
SDL_GetScancodeName
DECLSPEC const char *SDLCALL SDL_GetScancodeName(SDL_Scancode scancode)
Get a human-readable name for a scancode.
Definition: SDL_keyboard.c:887
SDL_PIXELFORMAT_INDEX1LSB
Definition: SDL_pixels.h:150
SDL_GetCurrentVideoDriver
DECLSPEC const char *SDLCALL SDL_GetCurrentVideoDriver(void)
Returns the name of the currently initialized video driver.
Definition: SDL_video.c:538
SDLTest_CommonState::gl_green_size
int gl_green_size
Definition: SDL_test_common.h:92
SDLTest_CommonState::renderers
SDL_Renderer ** renderers
Definition: SDL_test_common.h:84
SDL_GL_RED_SIZE
Definition: SDL_video.h:168
SDL_SetRelativeMouseMode
DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(SDL_bool enabled)
Set relative mouse mode.
Definition: SDL_mouse.c:430
SDLTest_PrintEvent
static void SDLTest_PrintEvent(SDL_Event *event)
Definition: SDL_test_common.c:943
SDL_WINDOWPOS_CENTERED_DISPLAY
#define SDL_WINDOWPOS_CENTERED_DISPLAY(X)
Definition: SDL_video.h:127
SDL_MaximizeWindow
DECLSPEC void SDLCALL SDL_MaximizeWindow(SDL_Window *window)
Make a window as large as possible.
Definition: SDL_video.c:1767
SDLK_SPACE
Definition: SDL_keycode.h:55
SDL_GL_DEPTH_SIZE
Definition: SDL_video.h:174
SDL_PIXELFORMAT_INDEX4MSB
Definition: SDL_pixels.h:159
SDL_SetColorKey
DECLSPEC int SDLCALL SDL_SetColorKey(SDL_Surface *surface, int flag, Uint32 key)
Sets the color key (transparent pixel) in a blittable surface.
Definition: SDL_surface.c:173
SDLK_r
Definition: SDL_keycode.h:114
SDLTest_CommonState::window_maxW
int window_maxW
Definition: SDL_test_common.h:70
SDL_PIXELFORMAT_ARGB8888
Definition: SDL_pixels.h:224
y
EGLSurface EGLint EGLint y
Definition: eglext.h:293
SDL_OutOfMemory
#define SDL_OutOfMemory()
Definition: SDL_error.h:52
SDL_INIT_VIDEO
#define SDL_INIT_VIDEO
Definition: SDL.h:110
SDL_Keysym::mod
Uint16 mod
Definition: SDL_keyboard.h:51
SDL_GetRelativeMouseMode
DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(void)
Query whether relative mouse mode is enabled.
Definition: SDL_mouse.c:478
SDL_arraysize
#define SDL_arraysize(array)
Definition: SDL_stdinc.h:83
SDL_INIT_AUDIO
#define SDL_INIT_AUDIO
Definition: SDL.h:109
SDL_RenderGetViewport
DECLSPEC void SDLCALL SDL_RenderGetViewport(SDL_Renderer *renderer, SDL_Rect *rect)
Get the drawing area for the current target.
Definition: SDL_render.c:1207
SDL_WINDOW_RESIZABLE
Definition: SDL_video.h:103
SDL_Surface::format
SDL_PixelFormat * format
Definition: SDL_surface.h:72
VERBOSE_MODES
#define VERBOSE_MODES
Definition: SDL_test_common.h:46
SDL_CreateWindow
DECLSPEC SDL_Window *SDLCALL SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags)
Create a window with the specified position, dimensions, and flags.
Definition: SDL_video.c:1190
SDL_GL_BUFFER_SIZE
Definition: SDL_video.h:172
SDL_WINDOW_BORDERLESS
Definition: SDL_video.h:102
SDL_FINGERUP
Definition: SDL_events.h:123
SDL_RendererInfo
Information on the capabilities of a render driver or context.
Definition: SDL_render.h:78
SDL_MOUSEMOTION
Definition: SDL_events.h:99
SDLTest_CommonState::gl_blue_size
int gl_blue_size
Definition: SDL_test_common.h:93
VERBOSE_RENDER
#define VERBOSE_RENDER
Definition: SDL_test_common.h:47
SDL_MouseMotionEvent
Mouse motion event structure (event.motion.*)
Definition: SDL_events.h:218
SDL_JoyHatEvent::hat
Uint8 hat
Definition: SDL_events.h:301
SDL_PIXELFORMAT_UYVY
Definition: SDL_pixels.h:246
SDL_SetWindowPosition
DECLSPEC void SDLCALL SDL_SetWindowPosition(SDL_Window *window, int x, int y)
Set the position of a window.
Definition: SDL_video.c:1535
SDLTest_CommonState::audiodriver
const char * audiodriver
Definition: SDL_test_common.h:87
SDL_GetRendererInfo
DECLSPEC int SDLCALL SDL_GetRendererInfo(SDL_Renderer *renderer, SDL_RendererInfo *info)
Get information about a rendering context.
Definition: SDL_render.c:329
SDL_WINDOWEVENT_SHOWN
Definition: SDL_video.h:138
flags
GLenum GLsizei GLsizei GLsizei GLsizei GLbitfield flags
Definition: glew.h:2767
SDL_TEXTINPUT
Definition: SDL_events.h:96
AUDIO_S16MSB
#define AUDIO_S16MSB
Definition: SDL_audio.h:94
SDL_Event::key
SDL_KeyboardEvent key
Definition: SDL_events.h:500
SDLTest_CommonState::gl_stencil_size
int gl_stencil_size
Definition: SDL_test_common.h:97
SDL_Rect::h
int h
Definition: SDL_rect.h:66
Uint8
uint8_t Uint8
An unsigned 8-bit integer type.
Definition: SDL_stdinc.h:129
SDL_HAT_LEFTUP
#define SDL_HAT_LEFTUP
Definition: SDL_joystick.h:198
SDL_PIXELFORMAT_RGB555
Definition: SDL_pixels.h:170
SDL_AudioSpec::format
SDL_AudioFormat format
Definition: SDL_audio.h:168
SDL_MouseMotionEvent::windowID
Uint32 windowID
Definition: SDL_events.h:222
SDL_Window
Definition: SDL_sysvideo.h:71
SDL_WINDOW_MAXIMIZED
Definition: SDL_video.h:105
SDL_atoi
DECLSPEC int SDLCALL SDL_atoi(const char *str)
Definition: SDL_string.c:774
SDL_PIXELFORMAT_RGBA8888
Definition: SDL_pixels.h:227
SDL_TouchFingerEvent::y
float y
Definition: SDL_events.h:391
SDL_MouseWheelEvent::x
Sint32 x
Definition: SDL_events.h:257
SDL_SetClipboardText
DECLSPEC int SDLCALL SDL_SetClipboardText(const char *text)
Put UTF-8 text into the clipboard.
Definition: SDL_clipboard.c:28
SDLTest_CommonState::logical_h
int logical_h
Definition: SDL_test_common.h:73
SDL_RenderSetClipRect
DECLSPEC int SDLCALL SDL_RenderSetClipRect(SDL_Renderer *renderer, const SDL_Rect *rect)
Set the clip rectangle for the current target.
Definition: SDL_render.c:1220
SDL_PixelFormatEnumToMasks
DECLSPEC SDL_bool SDLCALL SDL_PixelFormatEnumToMasks(Uint32 format, int *bpp, Uint32 *Rmask, Uint32 *Gmask, Uint32 *Bmask, Uint32 *Amask)
Convert one of the enumerated pixel formats to a bpp and RGBA masks.
Definition: SDL_pixels.c:132
SDL_WINDOW_FULLSCREEN
Definition: SDL_video.h:98
SDL_JoyHatEvent::value
Uint8 value
Definition: SDL_events.h:302
AUDIO_S16
#define AUDIO_S16
Definition: SDL_audio.h:96
AUDIO_S16LSB
#define AUDIO_S16LSB
Definition: SDL_audio.h:92
SDL_WINDOWEVENT_ENTER
Definition: SDL_video.h:150
SDL_WINDOWEVENT_EXPOSED
Definition: SDL_video.h:140
SDL_TouchFingerEvent::fingerId
SDL_FingerID fingerId
Definition: SDL_events.h:389
SDL_Keysym::sym
SDL_Keycode sym
Definition: SDL_keyboard.h:50
SDL_Surface::pitch
int pitch
Definition: SDL_surface.h:74
SDL_GetNumVideoDrivers
DECLSPEC int SDLCALL SDL_GetNumVideoDrivers(void)
Get the number of video drivers compiled into SDL.
Definition: SDL_video.c:388
SDL_DestroyWindow
DECLSPEC void SDLCALL SDL_DestroyWindow(SDL_Window *window)
Destroy a window.
Definition: SDL_video.c:2154
SDL_Event::button
SDL_MouseButtonEvent button
Definition: SDL_events.h:504
SDL_MouseButtonEvent::x
Sint32 x
Definition: SDL_events.h:244
SDL_AudioInit
DECLSPEC int SDLCALL SDL_AudioInit(const char *driver_name)
Definition: SDL_audio.c:562
SDLTest_ScreenShot
static void SDLTest_ScreenShot(SDL_Renderer *renderer)
Definition: SDL_test_common.c:1129
b
GLdouble GLdouble GLdouble b
Definition: glew.h:8383
SDLTest_CommonState::gl_alpha_size
int gl_alpha_size
Definition: SDL_test_common.h:94
SDL_RendererInfo::num_texture_formats
Uint32 num_texture_formats
Definition: SDL_render.h:82
SDLTest_CommonState::window_maxH
int window_maxH
Definition: SDL_test_common.h:71
w
GLint GLint GLint GLint GLint w
Definition: gl2ext.h:1215
SDL_PIXELFORMAT_RGB888
Definition: SDL_pixels.h:212
SDLK_v
Definition: SDL_keycode.h:118
SDL_PIXELFORMAT_BGR888
Definition: SDL_pixels.h:218
Uint16
uint16_t Uint16
An unsigned 16-bit integer type.
Definition: SDL_stdinc.h:137
SDL_Event
General event structure.
Definition: SDL_events.h:495
SDL_MouseWheelEvent::y
Sint32 y
Definition: SDL_events.h:258
SDL_GetNumRenderDrivers
DECLSPEC int SDLCALL SDL_GetNumRenderDrivers(void)
Get the number of 2D rendering drivers available for the current display.
Definition: SDL_render.c:78
SDL_WINDOW_OPENGL
Definition: SDL_video.h:99
SDL_WINDOWEVENT_RESIZED
Definition: SDL_video.h:144
SDL_Event::user
SDL_UserEvent user
Definition: SDL_events.h:515
SDL_GL_MULTISAMPLESAMPLES
Definition: SDL_video.h:182
SDL_PixelFormat::palette
SDL_Palette * palette
Definition: SDL_pixels.h:275
SDL_zero
#define SDL_zero(x)
Definition: SDL_stdinc.h:254
SDL_GetNumVideoDisplays
DECLSPEC int SDLCALL SDL_GetNumVideoDisplays(void)
Returns the number of available video displays.
Definition: SDL_video.c:597
FullscreenTo
static void FullscreenTo(int index, int windowId)
Definition: SDL_test_common.c:1164
SDL_DisplayMode::format
Uint32 format
Definition: SDL_video.h:55
SDL_JoyBallEvent::yrel
Sint16 yrel
Definition: SDL_events.h:290
SDL_PixelFormat::format
Uint32 format
Definition: SDL_pixels.h:274
SDL_Event::jhat
SDL_JoyHatEvent jhat
Definition: SDL_events.h:508
i
int i
Definition: pngrutil.c:1377
SDL_JoyButtonEvent::button
Uint8 button
Definition: SDL_events.h:321
SDLTest_CommonState::gl_accum_red_size
int gl_accum_red_size
Definition: SDL_test_common.h:99
SDLTest_CommonState::gl_red_size
int gl_red_size
Definition: SDL_test_common.h:91
SDLTest_CommonState::gl_accum_green_size
int gl_accum_green_size
Definition: SDL_test_common.h:100
SDL_HAT_CENTERED
#define SDL_HAT_CENTERED
Definition: SDL_joystick.h:191
SDL_GL_CONTEXT_DEBUG_FLAG
Definition: SDL_video.h:202
SDLTest_CommonState::gl_major_version
int gl_major_version
Definition: SDL_test_common.h:108
SDL_AudioQuit
DECLSPEC void SDLCALL SDL_AudioQuit(void)
Definition: SDL_audio.c:1175
AUDIO_U16
#define AUDIO_U16
Definition: SDL_audio.h:95
SDL_WindowEvent::data1
Sint32 data1
Definition: SDL_events.h:169
VERBOSE_VIDEO
#define VERBOSE_VIDEO
Definition: SDL_test_common.h:45
SDL_MouseButtonEvent::windowID
Uint32 windowID
Definition: SDL_events.h:238
SDL_CLIPBOARDUPDATE
Definition: SDL_events.h:132
AUDIO_S8
#define AUDIO_S8
Definition: SDL_audio.h:90
SDL_WINDOWEVENT_MOVED
Definition: SDL_video.h:142
SDLTest_CommonState::gl_accum_alpha_size
int gl_accum_alpha_size
Definition: SDL_test_common.h:102
SDL_PIXELFORMAT_YUY2
Definition: SDL_pixels.h:244
SDL_HAT_UP
#define SDL_HAT_UP
Definition: SDL_joystick.h:192
SDL_GetRenderDriverInfo
DECLSPEC int SDLCALL SDL_GetRenderDriverInfo(int index, SDL_RendererInfo *info)
Get information about a specific 2D rendering driver for the current display.
Definition: SDL_render.c:88
SDL_HAT_DOWN
#define SDL_HAT_DOWN
Definition: SDL_joystick.h:194
SDL_GL_CONTEXT_FLAGS
Definition: SDL_video.h:188
SDL_BYTEORDER
#define SDL_BYTEORDER
Definition: SDL_config_pandora.h:36
m
#define m(i, j)
DEFAULT_WINDOW_WIDTH
#define DEFAULT_WINDOW_WIDTH
Definition: SDL_test_common.h:41
SDL_isdigit
DECLSPEC int SDLCALL SDL_isdigit(int x)
Definition: SDL_stdlib.c:184
SDL_JoyHatEvent::which
SDL_JoystickID which
Definition: SDL_events.h:300
SDL_Rect::y
int y
Definition: SDL_rect.h:65
SDLTest_CommonState::videodriver
const char * videodriver
Definition: SDL_test_common.h:59
mode
GLenum mode
Definition: glew.h:2394
SDL_strcasecmp
DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1, const char *str2)
Definition: SDL_string.c:946
SDL_WindowEvent::windowID
Uint32 windowID
Definition: SDL_events.h:164
SDL_WINDOW_INPUT_GRABBED
Definition: SDL_video.h:106
SDLTest_CommonQuit
void SDLTest_CommonQuit(SDLTest_CommonState *state)
Close test window.
Definition: SDL_test_common.c:1399
SDL_WINDOW_FULLSCREEN_DESKTOP
Definition: SDL_video.h:109
SDL_GL_ACCELERATED_VISUAL
Definition: SDL_video.h:183
SDL_LOG_CATEGORY_VIDEO
Definition: SDL_log.h:71
SDL_Rect
A rectangle, with the origin at the upper left.
Definition: SDL_rect.h:63
SDL_OpenAudio
DECLSPEC int SDLCALL SDL_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained)
Definition: SDL_audio.c:1049
SDLTest_CommonState::gl_debug
int gl_debug
Definition: SDL_test_common.h:110
SDLTest_CommonState::window_minW
int window_minW
Definition: SDL_test_common.h:68
SDL_Event::type
Uint32 type
Definition: SDL_events.h:497
SDL_DestroyRenderer
DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_Renderer *renderer)
Destroy the rendering context for a window and free associated textures.
Definition: SDL_render.c:1832
event
cl_event event
Definition: glew.h:3556
SDLTest_CommonState::gl_accum_blue_size
int gl_accum_blue_size
Definition: SDL_test_common.h:101
SDLTest_CommonState::render_flags
Uint32 render_flags
Definition: SDL_test_common.h:82
AUDIO_U16MSB
#define AUDIO_U16MSB
Definition: SDL_audio.h:93
SDLTest_CommonState::logical_w
int logical_w
Definition: SDL_test_common.h:72
SDLK_b
Definition: SDL_keycode.h:98
SDL_Event::tfinger
SDL_TouchFingerEvent tfinger
Definition: SDL_events.h:517
SDLTest_CommonState::window_title
const char * window_title
Definition: SDL_test_common.h:61