Mercurial > sdl-ios-xcode
annotate test/nds-test-progs/sprite/source/common.c @ 2686:e9f27fe4f2a1 gsoc2008_nds
Existing testsprite programs made into NDS projects
author | Darren Alton <dalton@stevens.edu> |
---|---|
date | Wed, 13 Aug 2008 00:49:03 +0000 |
parents | |
children | 9dde605c7540 |
rev | line source |
---|---|
2686
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
1 |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
2 /* A simple test program framework */ |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
3 |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
4 #include <stdio.h> |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
5 |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
6 #include "common.h" |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
7 |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
8 #define VIDEO_USAGE \ |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
9 "[--video driver] [--renderer driver] [--info all|video|modes|render|event] [--display %d] [--fullscreen | --windows N] [--title title] [--center | --position X,Y] [--geometry WxH] [--depth N] [--refresh R] [--vsync] [--noframe] [--resize] [--minimize] [--maximize] [--grab]" |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
10 |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
11 #define AUDIO_USAGE \ |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
12 "[--rate N] [--format U8|S8|U16|U16LE|U16BE|S16|S16LE|S16BE] [--channels N] [--samples N]" |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
13 |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
14 CommonState * |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
15 CommonCreateState(char **argv, Uint32 flags) |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
16 { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
17 CommonState *state = SDL_calloc(1, sizeof(*state)); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
18 if (!state) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
19 SDL_OutOfMemory(); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
20 return NULL; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
21 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
22 |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
23 /* Initialize some defaults */ |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
24 state->argv = argv; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
25 state->flags = flags; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
26 state->window_title = argv[0]; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
27 state->window_flags = SDL_WINDOW_SHOWN; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
28 state->window_x = SDL_WINDOWPOS_UNDEFINED; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
29 state->window_y = SDL_WINDOWPOS_UNDEFINED; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
30 state->window_w = 256; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
31 state->window_h = 192; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
32 state->num_windows = 1; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
33 state->audiospec.freq = 22050; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
34 state->audiospec.format = AUDIO_S16; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
35 state->audiospec.channels = 2; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
36 state->audiospec.samples = 2048; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
37 return state; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
38 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
39 |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
40 int |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
41 CommonArg(CommonState * state, int index) |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
42 { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
43 char **argv = state->argv; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
44 |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
45 if (SDL_strcasecmp(argv[index], "--video") == 0) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
46 ++index; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
47 if (!argv[index]) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
48 return -1; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
49 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
50 state->videodriver = argv[index]; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
51 return 2; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
52 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
53 if (SDL_strcasecmp(argv[index], "--renderer") == 0) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
54 ++index; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
55 if (!argv[index]) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
56 return -1; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
57 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
58 state->renderdriver = argv[index]; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
59 return 2; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
60 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
61 if (SDL_strcasecmp(argv[index], "--info") == 0) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
62 ++index; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
63 if (!argv[index]) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
64 return -1; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
65 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
66 if (SDL_strcasecmp(argv[index], "all") == 0) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
67 state->verbose |= |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
68 (VERBOSE_VIDEO | VERBOSE_MODES | VERBOSE_RENDER | |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
69 VERBOSE_EVENT); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
70 return 2; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
71 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
72 if (SDL_strcasecmp(argv[index], "video") == 0) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
73 state->verbose |= VERBOSE_VIDEO; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
74 return 2; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
75 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
76 if (SDL_strcasecmp(argv[index], "modes") == 0) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
77 state->verbose |= VERBOSE_MODES; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
78 return 2; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
79 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
80 if (SDL_strcasecmp(argv[index], "render") == 0) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
81 state->verbose |= VERBOSE_RENDER; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
82 return 2; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
83 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
84 if (SDL_strcasecmp(argv[index], "event") == 0) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
85 state->verbose |= VERBOSE_EVENT; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
86 return 2; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
87 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
88 return -1; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
89 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
90 if (SDL_strcasecmp(argv[index], "--display") == 0) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
91 ++index; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
92 if (!argv[index]) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
93 return -1; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
94 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
95 state->display = SDL_atoi(argv[index]); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
96 return 2; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
97 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
98 if (SDL_strcasecmp(argv[index], "--fullscreen") == 0) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
99 state->window_flags |= SDL_WINDOW_FULLSCREEN; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
100 state->num_windows = 1; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
101 return 1; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
102 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
103 if (SDL_strcasecmp(argv[index], "--windows") == 0) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
104 ++index; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
105 if (!argv[index] || !SDL_isdigit(*argv[index])) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
106 return -1; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
107 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
108 if (!(state->window_flags & SDL_WINDOW_FULLSCREEN)) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
109 state->num_windows = SDL_atoi(argv[index]); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
110 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
111 return 2; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
112 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
113 if (SDL_strcasecmp(argv[index], "--title") == 0) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
114 ++index; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
115 if (!argv[index]) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
116 return -1; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
117 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
118 state->window_title = argv[index]; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
119 return 2; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
120 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
121 if (SDL_strcasecmp(argv[index], "--center") == 0) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
122 state->window_x = SDL_WINDOWPOS_CENTERED; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
123 state->window_y = SDL_WINDOWPOS_CENTERED; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
124 return 1; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
125 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
126 if (SDL_strcasecmp(argv[index], "--position") == 0) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
127 char *x, *y; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
128 ++index; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
129 if (!argv[index]) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
130 return -1; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
131 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
132 x = argv[index]; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
133 y = argv[index]; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
134 while (*y && *y != ',') { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
135 ++y; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
136 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
137 if (!*y) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
138 return -1; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
139 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
140 *y++ = '\0'; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
141 state->window_x = SDL_atoi(x); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
142 state->window_y = SDL_atoi(y); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
143 return 2; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
144 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
145 if (SDL_strcasecmp(argv[index], "--geometry") == 0) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
146 char *w, *h; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
147 ++index; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
148 if (!argv[index]) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
149 return -1; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
150 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
151 w = argv[index]; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
152 h = argv[index]; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
153 while (*h && *h != 'x') { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
154 ++h; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
155 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
156 if (!*h) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
157 return -1; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
158 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
159 *h++ = '\0'; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
160 state->window_w = SDL_atoi(w); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
161 state->window_h = SDL_atoi(h); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
162 return 2; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
163 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
164 if (SDL_strcasecmp(argv[index], "--depth") == 0) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
165 ++index; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
166 if (!argv[index]) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
167 return -1; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
168 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
169 state->depth = SDL_atoi(argv[index]); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
170 return 2; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
171 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
172 if (SDL_strcasecmp(argv[index], "--refresh") == 0) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
173 ++index; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
174 if (!argv[index]) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
175 return -1; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
176 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
177 state->refresh_rate = SDL_atoi(argv[index]); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
178 return 2; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
179 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
180 if (SDL_strcasecmp(argv[index], "--vsync") == 0) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
181 state->render_flags |= SDL_RENDERER_PRESENTVSYNC; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
182 return 1; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
183 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
184 if (SDL_strcasecmp(argv[index], "--noframe") == 0) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
185 state->window_flags |= SDL_WINDOW_BORDERLESS; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
186 return 1; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
187 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
188 if (SDL_strcasecmp(argv[index], "--resize") == 0) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
189 state->window_flags |= SDL_WINDOW_RESIZABLE; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
190 return 1; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
191 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
192 if (SDL_strcasecmp(argv[index], "--minimize") == 0) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
193 state->window_flags |= SDL_WINDOW_MINIMIZED; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
194 return 1; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
195 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
196 if (SDL_strcasecmp(argv[index], "--maximize") == 0) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
197 state->window_flags |= SDL_WINDOW_MAXIMIZED; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
198 return 1; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
199 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
200 if (SDL_strcasecmp(argv[index], "--grab") == 0) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
201 state->window_flags |= SDL_WINDOW_INPUT_GRABBED; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
202 return 1; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
203 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
204 if (SDL_strcasecmp(argv[index], "--rate") == 0) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
205 ++index; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
206 if (!argv[index]) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
207 return -1; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
208 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
209 state->audiospec.freq = SDL_atoi(argv[index]); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
210 return 2; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
211 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
212 if (SDL_strcasecmp(argv[index], "--format") == 0) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
213 ++index; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
214 if (!argv[index]) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
215 return -1; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
216 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
217 if (SDL_strcasecmp(argv[index], "U8") == 0) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
218 state->audiospec.format = AUDIO_U8; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
219 return 2; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
220 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
221 if (SDL_strcasecmp(argv[index], "S8") == 0) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
222 state->audiospec.format = AUDIO_S8; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
223 return 2; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
224 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
225 if (SDL_strcasecmp(argv[index], "U16") == 0) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
226 state->audiospec.format = AUDIO_U16; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
227 return 2; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
228 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
229 if (SDL_strcasecmp(argv[index], "U16LE") == 0) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
230 state->audiospec.format = AUDIO_U16LSB; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
231 return 2; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
232 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
233 if (SDL_strcasecmp(argv[index], "U16BE") == 0) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
234 state->audiospec.format = AUDIO_U16MSB; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
235 return 2; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
236 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
237 if (SDL_strcasecmp(argv[index], "S16") == 0) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
238 state->audiospec.format = AUDIO_S16; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
239 return 2; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
240 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
241 if (SDL_strcasecmp(argv[index], "S16LE") == 0) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
242 state->audiospec.format = AUDIO_S16LSB; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
243 return 2; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
244 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
245 if (SDL_strcasecmp(argv[index], "S16BE") == 0) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
246 state->audiospec.format = AUDIO_S16MSB; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
247 return 2; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
248 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
249 return -1; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
250 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
251 if (SDL_strcasecmp(argv[index], "--channels") == 0) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
252 ++index; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
253 if (!argv[index]) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
254 return -1; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
255 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
256 state->audiospec.channels = (Uint8) SDL_atoi(argv[index]); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
257 return 2; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
258 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
259 if (SDL_strcasecmp(argv[index], "--samples") == 0) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
260 ++index; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
261 if (!argv[index]) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
262 return -1; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
263 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
264 state->audiospec.samples = (Uint16) SDL_atoi(argv[index]); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
265 return 2; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
266 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
267 if ((SDL_strcasecmp(argv[index], "-h") == 0) |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
268 || (SDL_strcasecmp(argv[index], "--help") == 0)) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
269 /* Print the usage message */ |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
270 return -1; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
271 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
272 return 0; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
273 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
274 |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
275 const char * |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
276 CommonUsage(CommonState * state) |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
277 { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
278 switch (state->flags & (SDL_INIT_VIDEO | SDL_INIT_AUDIO)) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
279 case SDL_INIT_VIDEO: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
280 return VIDEO_USAGE; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
281 case SDL_INIT_AUDIO: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
282 return AUDIO_USAGE; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
283 case (SDL_INIT_VIDEO | SDL_INIT_AUDIO): |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
284 return VIDEO_USAGE " " AUDIO_USAGE; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
285 default: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
286 return ""; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
287 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
288 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
289 |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
290 static void |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
291 PrintRendererFlag(Uint32 flag) |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
292 { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
293 switch (flag) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
294 case SDL_RENDERER_SINGLEBUFFER: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
295 fprintf(stderr, "SingleBuffer"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
296 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
297 case SDL_RENDERER_PRESENTCOPY: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
298 fprintf(stderr, "PresentCopy"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
299 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
300 case SDL_RENDERER_PRESENTFLIP2: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
301 fprintf(stderr, "PresentFlip2"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
302 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
303 case SDL_RENDERER_PRESENTFLIP3: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
304 fprintf(stderr, "PresentFlip3"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
305 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
306 case SDL_RENDERER_PRESENTDISCARD: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
307 fprintf(stderr, "PresentDiscard"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
308 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
309 case SDL_RENDERER_PRESENTVSYNC: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
310 fprintf(stderr, "PresentVSync"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
311 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
312 case SDL_RENDERER_ACCELERATED: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
313 fprintf(stderr, "Accelerated"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
314 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
315 default: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
316 fprintf(stderr, "0x%8.8x", flag); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
317 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
318 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
319 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
320 |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
321 static void |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
322 PrintBlendMode(Uint32 flag) |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
323 { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
324 switch (flag) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
325 case SDL_TEXTUREBLENDMODE_NONE: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
326 fprintf(stderr, "None"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
327 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
328 case SDL_TEXTUREBLENDMODE_MASK: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
329 fprintf(stderr, "Mask"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
330 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
331 case SDL_TEXTUREBLENDMODE_BLEND: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
332 fprintf(stderr, "Blend"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
333 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
334 case SDL_TEXTUREBLENDMODE_ADD: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
335 fprintf(stderr, "Add"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
336 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
337 case SDL_TEXTUREBLENDMODE_MOD: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
338 fprintf(stderr, "Mod"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
339 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
340 default: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
341 fprintf(stderr, "0x%8.8x", flag); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
342 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
343 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
344 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
345 |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
346 static void |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
347 PrintScaleMode(Uint32 flag) |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
348 { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
349 switch (flag) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
350 case SDL_TEXTURESCALEMODE_NONE: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
351 fprintf(stderr, "None"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
352 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
353 case SDL_TEXTURESCALEMODE_FAST: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
354 fprintf(stderr, "Fast"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
355 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
356 case SDL_TEXTURESCALEMODE_SLOW: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
357 fprintf(stderr, "Slow"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
358 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
359 case SDL_TEXTURESCALEMODE_BEST: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
360 fprintf(stderr, "Best"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
361 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
362 default: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
363 fprintf(stderr, "0x%8.8x", flag); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
364 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
365 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
366 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
367 |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
368 static void |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
369 PrintPixelFormat(Uint32 format) |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
370 { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
371 switch (format) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
372 case SDL_PIXELFORMAT_UNKNOWN: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
373 fprintf(stderr, "Unknwon"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
374 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
375 case SDL_PIXELFORMAT_INDEX1LSB: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
376 fprintf(stderr, "Index1LSB"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
377 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
378 case SDL_PIXELFORMAT_INDEX1MSB: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
379 fprintf(stderr, "Index1MSB"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
380 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
381 case SDL_PIXELFORMAT_INDEX4LSB: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
382 fprintf(stderr, "Index4LSB"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
383 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
384 case SDL_PIXELFORMAT_INDEX4MSB: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
385 fprintf(stderr, "Index4MSB"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
386 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
387 case SDL_PIXELFORMAT_INDEX8: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
388 fprintf(stderr, "Index8"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
389 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
390 case SDL_PIXELFORMAT_RGB332: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
391 fprintf(stderr, "RGB332"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
392 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
393 case SDL_PIXELFORMAT_RGB444: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
394 fprintf(stderr, "RGB444"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
395 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
396 case SDL_PIXELFORMAT_RGB555: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
397 fprintf(stderr, "RGB555"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
398 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
399 case SDL_PIXELFORMAT_ARGB4444: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
400 fprintf(stderr, "ARGB4444"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
401 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
402 case SDL_PIXELFORMAT_ARGB1555: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
403 fprintf(stderr, "ARGB1555"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
404 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
405 case SDL_PIXELFORMAT_RGB565: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
406 fprintf(stderr, "RGB565"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
407 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
408 case SDL_PIXELFORMAT_RGB24: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
409 fprintf(stderr, "RGB24"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
410 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
411 case SDL_PIXELFORMAT_BGR24: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
412 fprintf(stderr, "BGR24"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
413 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
414 case SDL_PIXELFORMAT_RGB888: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
415 fprintf(stderr, "RGB888"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
416 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
417 case SDL_PIXELFORMAT_BGR888: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
418 fprintf(stderr, "BGR888"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
419 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
420 case SDL_PIXELFORMAT_ARGB8888: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
421 fprintf(stderr, "ARGB8888"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
422 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
423 case SDL_PIXELFORMAT_RGBA8888: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
424 fprintf(stderr, "RGBA8888"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
425 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
426 case SDL_PIXELFORMAT_ABGR8888: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
427 fprintf(stderr, "ABGR8888"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
428 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
429 case SDL_PIXELFORMAT_BGRA8888: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
430 fprintf(stderr, "BGRA8888"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
431 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
432 case SDL_PIXELFORMAT_ARGB2101010: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
433 fprintf(stderr, "ARGB2101010"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
434 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
435 case SDL_PIXELFORMAT_YV12: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
436 fprintf(stderr, "YV12"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
437 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
438 case SDL_PIXELFORMAT_IYUV: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
439 fprintf(stderr, "IYUV"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
440 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
441 case SDL_PIXELFORMAT_YUY2: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
442 fprintf(stderr, "YUY2"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
443 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
444 case SDL_PIXELFORMAT_UYVY: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
445 fprintf(stderr, "UYVY"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
446 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
447 case SDL_PIXELFORMAT_YVYU: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
448 fprintf(stderr, "YVYU"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
449 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
450 case SDL_PIXELFORMAT_ABGR1555: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
451 fprintf(stderr, "ABGR1555"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
452 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
453 case SDL_PIXELFORMAT_BGR555: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
454 fprintf(stderr, "BGR555"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
455 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
456 default: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
457 fprintf(stderr, "0x%8.8x", format); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
458 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
459 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
460 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
461 |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
462 static void |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
463 PrintRenderer(SDL_RendererInfo * info) |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
464 { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
465 int i, count; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
466 |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
467 fprintf(stderr, " Renderer %s:\n", info->name); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
468 |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
469 fprintf(stderr, " Flags: 0x%8.8X", info->flags); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
470 fprintf(stderr, " ("); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
471 count = 0; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
472 for (i = 0; i < sizeof(info->flags) * 8; ++i) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
473 Uint32 flag = (1 << i); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
474 if (info->flags & flag) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
475 if (count > 0) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
476 fprintf(stderr, " | "); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
477 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
478 PrintRendererFlag(flag); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
479 ++count; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
480 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
481 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
482 fprintf(stderr, ")\n"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
483 |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
484 fprintf(stderr, " Blend: 0x%8.8X", info->blend_modes); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
485 fprintf(stderr, " ("); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
486 count = 0; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
487 for (i = 0; i < sizeof(info->blend_modes) * 8; ++i) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
488 Uint32 flag = (1 << i); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
489 if (info->blend_modes & flag) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
490 if (count > 0) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
491 fprintf(stderr, " | "); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
492 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
493 PrintBlendMode(flag); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
494 ++count; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
495 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
496 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
497 fprintf(stderr, ")\n"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
498 |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
499 fprintf(stderr, " Scale: 0x%8.8X", info->scale_modes); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
500 fprintf(stderr, " ("); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
501 count = 0; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
502 for (i = 0; i < sizeof(info->scale_modes) * 8; ++i) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
503 Uint32 flag = (1 << i); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
504 if (info->scale_modes & flag) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
505 if (count > 0) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
506 fprintf(stderr, " | "); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
507 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
508 PrintScaleMode(flag); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
509 ++count; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
510 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
511 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
512 fprintf(stderr, ")\n"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
513 |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
514 fprintf(stderr, " Texture formats (%d): ", info->num_texture_formats); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
515 for (i = 0; i < (int) info->num_texture_formats; ++i) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
516 if (i > 0) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
517 fprintf(stderr, ", "); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
518 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
519 PrintPixelFormat(info->texture_formats[i]); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
520 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
521 fprintf(stderr, "\n"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
522 |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
523 if (info->max_texture_width || info->max_texture_height) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
524 fprintf(stderr, " Max Texture Size: %dx%d\n", |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
525 info->max_texture_width, info->max_texture_height); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
526 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
527 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
528 |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
529 SDL_bool |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
530 CommonInit(CommonState * state) |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
531 { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
532 int i, j, m, n; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
533 SDL_DisplayMode fullscreen_mode; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
534 |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
535 if (state->flags & SDL_INIT_VIDEO) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
536 if (state->verbose & VERBOSE_VIDEO) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
537 n = SDL_GetNumVideoDrivers(); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
538 if (n == 0) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
539 fprintf(stderr, "No built-in video drivers\n"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
540 } else { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
541 fprintf(stderr, "Built-in video drivers:"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
542 for (i = 0; i < n; ++i) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
543 if (i > 0) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
544 fprintf(stderr, ","); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
545 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
546 fprintf(stderr, " %s", SDL_GetVideoDriver(i)); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
547 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
548 fprintf(stderr, "\n"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
549 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
550 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
551 if (SDL_VideoInit(state->videodriver, 0) < 0) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
552 fprintf(stderr, "Couldn't initialize video driver: %s\n", |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
553 SDL_GetError()); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
554 return SDL_FALSE; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
555 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
556 if (state->verbose & VERBOSE_VIDEO) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
557 fprintf(stderr, "Video driver: %s\n", |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
558 SDL_GetCurrentVideoDriver()); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
559 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
560 |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
561 if (state->verbose & VERBOSE_MODES) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
562 SDL_DisplayMode mode; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
563 int bpp; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
564 Uint32 Rmask, Gmask, Bmask, Amask; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
565 |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
566 n = SDL_GetNumVideoDisplays(); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
567 fprintf(stderr, "Number of displays: %d\n", n); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
568 for (i = 0; i < n; ++i) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
569 fprintf(stderr, "Display %d:\n", i); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
570 SDL_SelectVideoDisplay(i); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
571 |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
572 SDL_GetDesktopDisplayMode(&mode); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
573 SDL_PixelFormatEnumToMasks(mode.format, &bpp, &Rmask, &Gmask, |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
574 &Bmask, &Amask); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
575 fprintf(stderr, |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
576 " Current mode: %dx%d@%dHz, %d bits-per-pixel\n", |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
577 mode.w, mode.h, mode.refresh_rate, bpp); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
578 if (Rmask || Gmask || Bmask) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
579 fprintf(stderr, " Red Mask = 0x%.8x\n", Rmask); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
580 fprintf(stderr, " Green Mask = 0x%.8x\n", Gmask); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
581 fprintf(stderr, " Blue Mask = 0x%.8x\n", Bmask); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
582 if (Amask) |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
583 fprintf(stderr, " Alpha Mask = 0x%.8x\n", Amask); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
584 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
585 |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
586 /* Print available fullscreen video modes */ |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
587 m = SDL_GetNumDisplayModes(); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
588 if (m == 0) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
589 fprintf(stderr, "No available fullscreen video modes\n"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
590 } else { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
591 fprintf(stderr, " Fullscreen video modes:\n"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
592 for (j = 0; j < m; ++j) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
593 SDL_GetDisplayMode(j, &mode); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
594 SDL_PixelFormatEnumToMasks(mode.format, &bpp, &Rmask, |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
595 &Gmask, &Bmask, &Amask); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
596 fprintf(stderr, |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
597 " Mode %d: %dx%d@%dHz, %d bits-per-pixel\n", |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
598 j, mode.w, mode.h, mode.refresh_rate, bpp); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
599 if (Rmask || Gmask || Bmask) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
600 fprintf(stderr, " Red Mask = 0x%.8x\n", |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
601 Rmask); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
602 fprintf(stderr, " Green Mask = 0x%.8x\n", |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
603 Gmask); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
604 fprintf(stderr, " Blue Mask = 0x%.8x\n", |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
605 Bmask); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
606 if (Amask) |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
607 fprintf(stderr, |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
608 " Alpha Mask = 0x%.8x\n", |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
609 Amask); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
610 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
611 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
612 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
613 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
614 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
615 |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
616 SDL_SelectVideoDisplay(state->display); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
617 if (state->verbose & VERBOSE_RENDER) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
618 SDL_RendererInfo info; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
619 |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
620 n = SDL_GetNumRenderDrivers(); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
621 if (n == 0) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
622 fprintf(stderr, "No built-in render drivers\n"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
623 } else { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
624 fprintf(stderr, "Built-in render drivers:\n"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
625 for (i = 0; i < n; ++i) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
626 SDL_GetRenderDriverInfo(i, &info); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
627 PrintRenderer(&info); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
628 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
629 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
630 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
631 |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
632 switch (state->depth) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
633 case 8: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
634 fullscreen_mode.format = SDL_PIXELFORMAT_INDEX8; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
635 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
636 case 15: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
637 fullscreen_mode.format = SDL_PIXELFORMAT_BGR555; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
638 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
639 case 16: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
640 default: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
641 fullscreen_mode.format = SDL_PIXELFORMAT_ABGR1555; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
642 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
643 /* NDS default: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
644 fullscreen_mode.format = SDL_PIXELFORMAT_RGB888; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
645 break;*/ |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
646 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
647 fullscreen_mode.w = state->window_w; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
648 fullscreen_mode.h = state->window_h; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
649 fullscreen_mode.refresh_rate = state->refresh_rate; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
650 SDL_SetFullscreenDisplayMode(&fullscreen_mode); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
651 |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
652 state->windows = |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
653 (SDL_WindowID *) SDL_malloc(state->num_windows * |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
654 sizeof(*state->windows)); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
655 if (!state->windows) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
656 fprintf(stderr, "Out of memory!\n"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
657 return SDL_FALSE; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
658 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
659 for (i = 0; i < state->num_windows; ++i) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
660 char title[1024]; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
661 |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
662 if (state->num_windows > 1) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
663 SDL_snprintf(title, SDL_arraysize(title), "%s %d", |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
664 state->window_title, i + 1); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
665 } else { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
666 SDL_strlcpy(title, state->window_title, SDL_arraysize(title)); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
667 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
668 state->windows[i] = |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
669 SDL_CreateWindow(title, state->window_x, state->window_y, |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
670 state->window_w, state->window_h, |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
671 state->window_flags); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
672 if (!state->windows[i]) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
673 fprintf(stderr, "Couldn't create window: %s\n", |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
674 SDL_GetError()); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
675 return SDL_FALSE; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
676 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
677 |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
678 if (!state->skip_renderer |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
679 && (state->renderdriver |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
680 || !(state->window_flags & SDL_WINDOW_OPENGL))) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
681 m = -1; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
682 if (state->renderdriver) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
683 SDL_RendererInfo info; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
684 n = SDL_GetNumRenderDrivers(); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
685 for (j = 0; j < n; ++j) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
686 SDL_GetRenderDriverInfo(j, &info); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
687 if (SDL_strcasecmp(info.name, state->renderdriver) == |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
688 0) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
689 m = j; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
690 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
691 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
692 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
693 if (m == n) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
694 fprintf(stderr, |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
695 "Couldn't find render driver named %s", |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
696 state->renderdriver); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
697 return SDL_FALSE; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
698 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
699 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
700 if (SDL_CreateRenderer |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
701 (state->windows[i], m, state->render_flags) < 0) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
702 fprintf(stderr, "Couldn't create renderer: %s\n", |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
703 SDL_GetError()); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
704 return SDL_FALSE; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
705 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
706 if (state->verbose & VERBOSE_RENDER) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
707 SDL_RendererInfo info; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
708 |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
709 fprintf(stderr, "Current renderer:\n"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
710 SDL_GetRendererInfo(&info); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
711 PrintRenderer(&info); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
712 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
713 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
714 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
715 SDL_SelectRenderer(state->windows[0]); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
716 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
717 |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
718 if (state->flags & SDL_INIT_AUDIO) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
719 if (state->verbose & VERBOSE_AUDIO) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
720 n = SDL_GetNumAudioDrivers(); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
721 if (n == 0) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
722 fprintf(stderr, "No built-in audio drivers\n"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
723 } else { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
724 fprintf(stderr, "Built-in audio drivers:"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
725 for (i = 0; i < n; ++i) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
726 if (i > 0) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
727 fprintf(stderr, ","); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
728 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
729 fprintf(stderr, " %s", SDL_GetAudioDriver(i)); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
730 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
731 fprintf(stderr, "\n"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
732 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
733 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
734 if (SDL_AudioInit(state->audiodriver) < 0) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
735 fprintf(stderr, "Couldn't initialize audio driver: %s\n", |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
736 SDL_GetError()); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
737 return SDL_FALSE; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
738 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
739 if (state->verbose & VERBOSE_VIDEO) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
740 fprintf(stderr, "Audio driver: %s\n", |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
741 SDL_GetCurrentAudioDriver()); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
742 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
743 |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
744 if (SDL_OpenAudio(&state->audiospec, NULL) < 0) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
745 fprintf(stderr, "Couldn't open audio: %s\n", SDL_GetError()); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
746 return SDL_FALSE; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
747 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
748 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
749 |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
750 return SDL_TRUE; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
751 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
752 |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
753 static void |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
754 PrintEvent(SDL_Event * event) |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
755 { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
756 fprintf(stderr, "SDL EVENT: "); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
757 switch (event->type) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
758 case SDL_WINDOWEVENT: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
759 switch (event->window.event) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
760 case SDL_WINDOWEVENT_SHOWN: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
761 fprintf(stderr, "Window %d shown", event->window.windowID); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
762 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
763 case SDL_WINDOWEVENT_HIDDEN: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
764 fprintf(stderr, "Window %d hidden", event->window.windowID); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
765 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
766 case SDL_WINDOWEVENT_EXPOSED: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
767 fprintf(stderr, "Window %d exposed", event->window.windowID); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
768 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
769 case SDL_WINDOWEVENT_MOVED: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
770 fprintf(stderr, "Window %d moved to %d,%d", |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
771 event->window.windowID, event->window.data1, |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
772 event->window.data2); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
773 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
774 case SDL_WINDOWEVENT_RESIZED: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
775 fprintf(stderr, "Window %d resized to %dx%d", |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
776 event->window.windowID, event->window.data1, |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
777 event->window.data2); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
778 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
779 case SDL_WINDOWEVENT_MINIMIZED: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
780 fprintf(stderr, "Window %d minimized", event->window.windowID); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
781 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
782 case SDL_WINDOWEVENT_MAXIMIZED: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
783 fprintf(stderr, "Window %d maximized", event->window.windowID); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
784 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
785 case SDL_WINDOWEVENT_RESTORED: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
786 fprintf(stderr, "Window %d restored", event->window.windowID); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
787 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
788 case SDL_WINDOWEVENT_ENTER: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
789 fprintf(stderr, "Mouse entered window %d", |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
790 event->window.windowID); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
791 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
792 case SDL_WINDOWEVENT_LEAVE: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
793 fprintf(stderr, "Mouse left window %d", event->window.windowID); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
794 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
795 case SDL_WINDOWEVENT_FOCUS_GAINED: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
796 fprintf(stderr, "Window %d gained keyboard focus", |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
797 event->window.windowID); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
798 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
799 case SDL_WINDOWEVENT_FOCUS_LOST: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
800 fprintf(stderr, "Window %d lost keyboard focus", |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
801 event->window.windowID); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
802 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
803 case SDL_WINDOWEVENT_CLOSE: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
804 fprintf(stderr, "Window %d closed", event->window.windowID); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
805 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
806 default: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
807 fprintf(stderr, "Window %d got unknown event %d", |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
808 event->window.windowID, event->window.event); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
809 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
810 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
811 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
812 case SDL_KEYDOWN: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
813 fprintf(stderr, |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
814 "Keyboard %d: key pressed in window %d: scancode 0x%08X = %s, keycode 0x%08X = %s", |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
815 event->key.which, event->key.windowID, |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
816 event->key.keysym.scancode, |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
817 SDL_GetScancodeName(event->key.keysym.scancode), |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
818 event->key.keysym.sym, SDL_GetKeyName(event->key.keysym.sym)); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
819 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
820 case SDL_KEYUP: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
821 fprintf(stderr, |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
822 "Keyboard %d: key released in window %d: scancode 0x%08X = %s, keycode 0x%08X = %s", |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
823 event->key.which, event->key.windowID, |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
824 event->key.keysym.scancode, |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
825 SDL_GetScancodeName(event->key.keysym.scancode), |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
826 event->key.keysym.sym, SDL_GetKeyName(event->key.keysym.sym)); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
827 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
828 case SDL_TEXTINPUT: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
829 fprintf(stderr, "Keyboard %d: text input \"%s\" in window %d", |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
830 event->text.which, event->text.text, event->text.windowID); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
831 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
832 case SDL_MOUSEMOTION: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
833 fprintf(stderr, "Mouse %d: moved to %d,%d (%d,%d) in window %d", |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
834 event->motion.which, event->motion.x, event->motion.y, |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
835 event->motion.xrel, event->motion.yrel, |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
836 event->motion.windowID); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
837 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
838 case SDL_MOUSEBUTTONDOWN: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
839 fprintf(stderr, "Mouse %d: button %d pressed at %d,%d in window %d", |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
840 event->button.which, event->button.button, event->button.x, |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
841 event->button.y, event->button.windowID); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
842 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
843 case SDL_MOUSEBUTTONUP: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
844 fprintf(stderr, "Mouse %d: button %d released at %d,%d in window %d", |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
845 event->button.which, event->button.button, event->button.x, |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
846 event->button.y, event->button.windowID); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
847 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
848 case SDL_MOUSEWHEEL: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
849 fprintf(stderr, |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
850 "Mouse %d: wheel scrolled %d in x and %d in y in window %d", |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
851 event->wheel.which, event->wheel.x, event->wheel.y, |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
852 event->wheel.windowID); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
853 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
854 case SDL_JOYBALLMOTION: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
855 fprintf(stderr, "Joystick %d: ball %d moved by %d,%d", |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
856 event->jball.which, event->jball.ball, event->jball.xrel, |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
857 event->jball.yrel); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
858 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
859 case SDL_JOYHATMOTION: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
860 fprintf(stderr, "Joystick %d: hat %d moved to ", event->jhat.which, |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
861 event->jhat.hat); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
862 switch (event->jhat.value) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
863 case SDL_HAT_CENTERED: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
864 fprintf(stderr, "CENTER"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
865 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
866 case SDL_HAT_UP: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
867 fprintf(stderr, "UP"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
868 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
869 case SDL_HAT_RIGHTUP: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
870 fprintf(stderr, "RIGHTUP"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
871 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
872 case SDL_HAT_RIGHT: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
873 fprintf(stderr, "RIGHT"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
874 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
875 case SDL_HAT_RIGHTDOWN: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
876 fprintf(stderr, "RIGHTDOWN"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
877 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
878 case SDL_HAT_DOWN: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
879 fprintf(stderr, "DOWN"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
880 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
881 case SDL_HAT_LEFTDOWN: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
882 fprintf(stderr, "LEFTDOWN"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
883 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
884 case SDL_HAT_LEFT: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
885 fprintf(stderr, "LEFT"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
886 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
887 case SDL_HAT_LEFTUP: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
888 fprintf(stderr, "LEFTUP"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
889 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
890 default: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
891 fprintf(stderr, "UNKNOWN"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
892 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
893 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
894 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
895 case SDL_JOYBUTTONDOWN: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
896 fprintf(stderr, "Joystick %d: button %d pressed", |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
897 event->jbutton.which, event->jbutton.button); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
898 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
899 case SDL_JOYBUTTONUP: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
900 fprintf(stderr, "Joystick %d: button %d released", |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
901 event->jbutton.which, event->jbutton.button); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
902 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
903 case SDL_QUIT: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
904 fprintf(stderr, "Quit requested"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
905 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
906 case SDL_USEREVENT: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
907 fprintf(stderr, "User event %d", event->user.code); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
908 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
909 default: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
910 fprintf(stderr, "Unknown event %d", event->type); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
911 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
912 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
913 fprintf(stderr, "\n"); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
914 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
915 |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
916 void |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
917 CommonEvent(CommonState * state, SDL_Event * event, int *done) |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
918 { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
919 if (state->verbose & VERBOSE_EVENT) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
920 PrintEvent(event); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
921 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
922 |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
923 switch (event->type) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
924 case SDL_WINDOWEVENT: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
925 switch (event->window.event) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
926 case SDL_WINDOWEVENT_CLOSE: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
927 *done = 1; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
928 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
929 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
930 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
931 case SDL_KEYDOWN: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
932 switch (event->key.keysym.sym) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
933 /* Add hotkeys here */ |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
934 case SDLK_g: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
935 if (event->key.keysym.mod & KMOD_CTRL) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
936 /* Ctrl-G toggle grab */ |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
937 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
938 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
939 case SDLK_ESCAPE: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
940 *done = 1; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
941 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
942 default: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
943 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
944 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
945 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
946 case SDL_QUIT: |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
947 *done = 1; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
948 break; |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
949 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
950 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
951 |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
952 void |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
953 CommonQuit(CommonState * state) |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
954 { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
955 if (state->flags & SDL_INIT_VIDEO) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
956 SDL_VideoQuit(); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
957 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
958 if (state->flags & SDL_INIT_AUDIO) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
959 SDL_AudioQuit(); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
960 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
961 if (state->windows) { |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
962 SDL_free(state->windows); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
963 } |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
964 SDL_free(state); |
e9f27fe4f2a1
Existing testsprite programs made into NDS projects
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
965 } |