comparison test/testwm.c @ 1662:782fd950bd46 SDL-1.3

Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API. WARNING: None of the video drivers have been updated for the new API yet! The API is still under design and very fluid. The code is now run through a consistent indent format: indent -i4 -nut -nsc -br -ce The headers are being converted to automatically generate doxygen documentation.
author Sam Lantinga <slouken@libsdl.org>
date Sun, 28 May 2006 13:04:16 +0000
parents 14717b52abc0
children 4da1ee79c9af
comparison
equal deleted inserted replaced
1661:281d3f4870e5 1662:782fd950bd46
8 #include "SDL.h" 8 #include "SDL.h"
9 9
10 /* Is the cursor visible? */ 10 /* Is the cursor visible? */
11 static int visible = 1; 11 static int visible = 1;
12 12
13 static Uint8 video_bpp; 13 static Uint8 video_bpp;
14 static Uint32 video_flags; 14 static Uint32 video_flags;
15 15
16 /* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */ 16 /* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */
17 static void quit(int rc) 17 static void
18 { 18 quit (int rc)
19 SDL_Quit(); 19 {
20 exit(rc); 20 SDL_Quit ();
21 } 21 exit (rc);
22 22 }
23 int SetVideoMode(int w, int h) 23
24 { 24 int
25 SDL_Surface *screen; 25 SetVideoMode (int w, int h)
26 int i; 26 {
27 Uint8 *buffer; 27 SDL_Surface *screen;
28 SDL_Color palette[256]; 28 int i;
29 29 Uint8 *buffer;
30 screen = SDL_SetVideoMode(w, h, video_bpp, video_flags); 30 SDL_Color palette[256];
31 if ( screen == NULL ) { 31
32 fprintf(stderr, "Couldn't set %dx%dx%d video mode: %s\n", 32 screen = SDL_SetVideoMode (w, h, video_bpp, video_flags);
33 w, h, video_bpp, SDL_GetError()); 33 if (screen == NULL) {
34 return(-1); 34 fprintf (stderr, "Couldn't set %dx%dx%d video mode: %s\n",
35 } 35 w, h, video_bpp, SDL_GetError ());
36 printf("Running in %s mode\n", screen->flags & SDL_FULLSCREEN ? 36 return (-1);
37 "fullscreen" : "windowed"); 37 }
38 38 printf ("Running in %s mode\n", screen->flags & SDL_FULLSCREEN ?
39 /* Set the surface pixels and refresh! */ 39 "fullscreen" : "windowed");
40 for ( i=0; i<256; ++i ) { 40
41 palette[i].r = 255-i; 41 /* Set the surface pixels and refresh! */
42 palette[i].g = 255-i; 42 for (i = 0; i < 256; ++i) {
43 palette[i].b = 255-i; 43 palette[i].r = 255 - i;
44 } 44 palette[i].g = 255 - i;
45 SDL_SetColors(screen, palette, 0, 256); 45 palette[i].b = 255 - i;
46 if ( SDL_LockSurface(screen) < 0 ) { 46 }
47 fprintf(stderr, "Couldn't lock display surface: %s\n", 47 SDL_SetColors (screen, palette, 0, 256);
48 SDL_GetError()); 48 if (SDL_LockSurface (screen) < 0) {
49 return(-1); 49 fprintf (stderr, "Couldn't lock display surface: %s\n",
50 } 50 SDL_GetError ());
51 buffer = (Uint8 *)screen->pixels; 51 return (-1);
52 for ( i=0; i<screen->h; ++i ) { 52 }
53 memset(buffer,(i*255)/screen->h, 53 buffer = (Uint8 *) screen->pixels;
54 screen->w*screen->format->BytesPerPixel); 54 for (i = 0; i < screen->h; ++i) {
55 buffer += screen->pitch; 55 memset (buffer, (i * 255) / screen->h,
56 } 56 screen->w * screen->format->BytesPerPixel);
57 SDL_UnlockSurface(screen); 57 buffer += screen->pitch;
58 SDL_UpdateRect(screen, 0, 0, 0, 0); 58 }
59 59 SDL_UnlockSurface (screen);
60 return(0); 60 SDL_UpdateRect (screen, 0, 0, 0, 0);
61 } 61
62 62 return (0);
63 SDL_Surface *LoadIconSurface(char *file, Uint8 **maskp) 63 }
64 { 64
65 SDL_Surface *icon; 65 SDL_Surface *
66 Uint8 *pixels; 66 LoadIconSurface (char *file, Uint8 ** maskp)
67 Uint8 *mask; 67 {
68 int mlen, i, j; 68 SDL_Surface *icon;
69 69 Uint8 *pixels;
70 *maskp = NULL; 70 Uint8 *mask;
71 71 int mlen, i, j;
72 /* Load the icon surface */ 72
73 icon = SDL_LoadBMP(file); 73 *maskp = NULL;
74 if ( icon == NULL ) { 74
75 fprintf(stderr, "Couldn't load %s: %s\n", file, SDL_GetError()); 75 /* Load the icon surface */
76 return(NULL); 76 icon = SDL_LoadBMP (file);
77 } 77 if (icon == NULL) {
78 78 fprintf (stderr, "Couldn't load %s: %s\n", file, SDL_GetError ());
79 /* Check width and height 79 return (NULL);
80 if ( (icon->w%8) != 0 ) { 80 }
81 fprintf(stderr, "Icon width must be a multiple of 8!\n"); 81
82 SDL_FreeSurface(icon); 82 /* Check width and height
83 return(NULL); 83 if ( (icon->w%8) != 0 ) {
84 } 84 fprintf(stderr, "Icon width must be a multiple of 8!\n");
85 */ 85 SDL_FreeSurface(icon);
86 86 return(NULL);
87 87 }
88 if ( icon->format->palette == NULL ) { 88 */
89 fprintf(stderr, "Icon must have a palette!\n"); 89
90 SDL_FreeSurface(icon); 90
91 return(NULL); 91 if (icon->format->palette == NULL) {
92 } 92 fprintf (stderr, "Icon must have a palette!\n");
93 93 SDL_FreeSurface (icon);
94 /* Set the colorkey */ 94 return (NULL);
95 SDL_SetColorKey(icon, SDL_SRCCOLORKEY, *((Uint8 *)icon->pixels)); 95 }
96 96
97 /* Create the mask */ 97 /* Set the colorkey */
98 pixels = (Uint8 *)icon->pixels; 98 SDL_SetColorKey (icon, SDL_SRCCOLORKEY, *((Uint8 *) icon->pixels));
99 printf("Transparent pixel: (%d,%d,%d)\n", 99
100 icon->format->palette->colors[*pixels].r, 100 /* Create the mask */
101 icon->format->palette->colors[*pixels].g, 101 pixels = (Uint8 *) icon->pixels;
102 icon->format->palette->colors[*pixels].b); 102 printf ("Transparent pixel: (%d,%d,%d)\n",
103 mlen = (icon->w*icon->h + 7) / 8; 103 icon->format->palette->colors[*pixels].r,
104 mask = (Uint8 *)malloc(mlen); 104 icon->format->palette->colors[*pixels].g,
105 if ( mask == NULL ) { 105 icon->format->palette->colors[*pixels].b);
106 fprintf(stderr, "Out of memory!\n"); 106 mlen = (icon->w * icon->h + 7) / 8;
107 SDL_FreeSurface(icon); 107 mask = (Uint8 *) malloc (mlen);
108 return(NULL); 108 if (mask == NULL) {
109 } 109 fprintf (stderr, "Out of memory!\n");
110 memset(mask, 0, mlen); 110 SDL_FreeSurface (icon);
111 for ( i=0; i < icon->h; i++) 111 return (NULL);
112 for (j=0; j < icon->w; j++) { 112 }
113 memset (mask, 0, mlen);
114 for (i = 0; i < icon->h; i++)
115 for (j = 0; j < icon->w; j++) {
113 int pindex = i * icon->pitch + j; 116 int pindex = i * icon->pitch + j;
114 int mindex = i * icon->w + j; 117 int mindex = i * icon->w + j;
115 if ( pixels[pindex] != *pixels ) 118 if (pixels[pindex] != *pixels)
116 mask[mindex>>3] |= 1 << (7 - (mindex & 7)); 119 mask[mindex >> 3] |= 1 << (7 - (mindex & 7));
117 } 120 }
118 *maskp = mask; 121 *maskp = mask;
119 return(icon); 122 return (icon);
120 } 123 }
121 124
122 void HotKey_ToggleFullScreen(void) 125 void
123 { 126 HotKey_ToggleFullScreen (void)
124 SDL_Surface *screen; 127 {
125 128 SDL_Surface *screen;
126 screen = SDL_GetVideoSurface(); 129
127 if ( SDL_WM_ToggleFullScreen(screen) ) { 130 screen = SDL_GetVideoSurface ();
128 printf("Toggled fullscreen mode - now %s\n", 131 if (SDL_WM_ToggleFullScreen (screen)) {
129 (screen->flags&SDL_FULLSCREEN) ? "fullscreen" : "windowed"); 132 printf ("Toggled fullscreen mode - now %s\n",
130 } else { 133 (screen->flags & SDL_FULLSCREEN) ? "fullscreen" : "windowed");
131 printf("Unable to toggle fullscreen mode\n"); 134 } else {
132 video_flags ^= SDL_FULLSCREEN; 135 printf ("Unable to toggle fullscreen mode\n");
133 SetVideoMode(screen->w, screen->h); 136 video_flags ^= SDL_FULLSCREEN;
134 } 137 SetVideoMode (screen->w, screen->h);
135 } 138 }
136 139 }
137 void HotKey_ToggleGrab(void) 140
138 { 141 void
139 SDL_GrabMode mode; 142 HotKey_ToggleGrab (void)
140 143 {
141 printf("Ctrl-G: toggling input grab!\n"); 144 SDL_GrabMode mode;
142 mode = SDL_WM_GrabInput(SDL_GRAB_QUERY); 145
143 if ( mode == SDL_GRAB_ON ) { 146 printf ("Ctrl-G: toggling input grab!\n");
144 printf("Grab was on\n"); 147 mode = SDL_WM_GrabInput (SDL_GRAB_QUERY);
145 } else { 148 if (mode == SDL_GRAB_ON) {
146 printf("Grab was off\n"); 149 printf ("Grab was on\n");
147 } 150 } else {
148 mode = SDL_WM_GrabInput(mode ? SDL_GRAB_OFF : SDL_GRAB_ON); 151 printf ("Grab was off\n");
149 if ( mode == SDL_GRAB_ON ) { 152 }
150 printf("Grab is now on\n"); 153 mode = SDL_WM_GrabInput (mode ? SDL_GRAB_OFF : SDL_GRAB_ON);
151 } else { 154 if (mode == SDL_GRAB_ON) {
152 printf("Grab is now off\n"); 155 printf ("Grab is now on\n");
153 } 156 } else {
154 } 157 printf ("Grab is now off\n");
155 158 }
156 void HotKey_Iconify(void) 159 }
157 { 160
158 printf("Ctrl-Z: iconifying window!\n"); 161 void
159 SDL_WM_IconifyWindow(); 162 HotKey_Iconify (void)
160 } 163 {
161 164 printf ("Ctrl-Z: iconifying window!\n");
162 void HotKey_Quit(void) 165 SDL_WM_IconifyWindow ();
163 { 166 }
164 SDL_Event event; 167
165 168 void
166 printf("Posting internal quit request\n"); 169 HotKey_Quit (void)
167 event.type = SDL_USEREVENT; 170 {
168 SDL_PushEvent(&event); 171 SDL_Event event;
169 } 172
170 173 printf ("Posting internal quit request\n");
171 int SDLCALL FilterEvents(const SDL_Event *event) 174 event.type = SDL_USEREVENT;
172 { 175 SDL_PushEvent (&event);
173 static int reallyquit = 0; 176 }
174 177
175 switch (event->type) { 178 int SDLCALL
176 179 FilterEvents (const SDL_Event * event)
177 case SDL_ACTIVEEVENT: 180 {
178 /* See what happened */ 181 static int reallyquit = 0;
179 printf("App %s ", 182
180 event->active.gain ? "gained" : "lost"); 183 switch (event->type) {
181 if ( event->active.state & SDL_APPACTIVE ) 184
182 printf("active "); 185 case SDL_ACTIVEEVENT:
183 if ( event->active.state & SDL_APPINPUTFOCUS ) 186 /* See what happened */
184 printf("input "); 187 printf ("App %s ", event->active.gain ? "gained" : "lost");
185 if ( event->active.state & SDL_APPMOUSEFOCUS ) 188 if (event->active.state & SDL_APPACTIVE)
186 printf("mouse "); 189 printf ("active ");
187 printf("focus\n"); 190 if (event->active.state & SDL_APPINPUTFOCUS)
188 191 printf ("input ");
189 /* See if we are iconified or restored */ 192 if (event->active.state & SDL_APPMOUSEFOCUS)
190 if ( event->active.state & SDL_APPACTIVE ) { 193 printf ("mouse ");
191 printf("App has been %s\n", 194 printf ("focus\n");
192 event->active.gain ? 195
193 "restored" : "iconified"); 196 /* See if we are iconified or restored */
194 } 197 if (event->active.state & SDL_APPACTIVE) {
195 return(0); 198 printf ("App has been %s\n",
196 199 event->active.gain ? "restored" : "iconified");
197 /* We want to toggle visibility on buttonpress */ 200 }
198 case SDL_MOUSEBUTTONDOWN: 201 return (0);
199 case SDL_MOUSEBUTTONUP: 202
200 if ( event->button.state == SDL_PRESSED ) { 203 /* We want to toggle visibility on buttonpress */
201 visible = !visible; 204 case SDL_MOUSEBUTTONDOWN:
202 SDL_ShowCursor(visible); 205 case SDL_MOUSEBUTTONUP:
203 } 206 if (event->button.state == SDL_PRESSED) {
204 printf("Mouse button %d has been %s\n", 207 visible = !visible;
205 event->button.button, 208 SDL_ShowCursor (visible);
206 (event->button.state == SDL_PRESSED) ? 209 }
207 "pressed" : "released"); 210 printf ("Mouse button %d has been %s\n",
208 return(0); 211 event->button.button,
209 212 (event->button.state == SDL_PRESSED) ?
210 /* Show relative mouse motion */ 213 "pressed" : "released");
211 case SDL_MOUSEMOTION: 214 return (0);
215
216 /* Show relative mouse motion */
217 case SDL_MOUSEMOTION:
212 #if 0 218 #if 0
213 printf("Mouse motion: {%d,%d} (%d,%d)\n", 219 printf ("Mouse motion: {%d,%d} (%d,%d)\n",
214 event->motion.x, event->motion.y, 220 event->motion.x, event->motion.y,
215 event->motion.xrel, event->motion.yrel); 221 event->motion.xrel, event->motion.yrel);
216 #endif 222 #endif
217 return(0); 223 return (0);
218 224
219 case SDL_KEYDOWN: 225 case SDL_KEYDOWN:
220 if ( event->key.keysym.sym == SDLK_ESCAPE ) { 226 if (event->key.keysym.sym == SDLK_ESCAPE) {
221 HotKey_Quit(); 227 HotKey_Quit ();
222 } 228 }
223 if ( (event->key.keysym.sym == SDLK_g) && 229 if ((event->key.keysym.sym == SDLK_g) &&
224 (event->key.keysym.mod & KMOD_CTRL) ) { 230 (event->key.keysym.mod & KMOD_CTRL)) {
225 HotKey_ToggleGrab(); 231 HotKey_ToggleGrab ();
226 } 232 }
227 if ( (event->key.keysym.sym == SDLK_z) && 233 if ((event->key.keysym.sym == SDLK_z) &&
228 (event->key.keysym.mod & KMOD_CTRL) ) { 234 (event->key.keysym.mod & KMOD_CTRL)) {
229 HotKey_Iconify(); 235 HotKey_Iconify ();
230 } 236 }
231 if ( (event->key.keysym.sym == SDLK_RETURN) && 237 if ((event->key.keysym.sym == SDLK_RETURN) &&
232 (event->key.keysym.mod & KMOD_ALT) ) { 238 (event->key.keysym.mod & KMOD_ALT)) {
233 HotKey_ToggleFullScreen(); 239 HotKey_ToggleFullScreen ();
234 } 240 }
235 return(0); 241 return (0);
236 242
237 /* Pass the video resize event through .. */ 243 /* Pass the video resize event through .. */
238 case SDL_VIDEORESIZE: 244 case SDL_VIDEORESIZE:
239 return(1); 245 return (1);
240 246
241 /* This is important! Queue it if we want to quit. */ 247 /* This is important! Queue it if we want to quit. */
242 case SDL_QUIT: 248 case SDL_QUIT:
243 if ( ! reallyquit ) { 249 if (!reallyquit) {
244 reallyquit = 1; 250 reallyquit = 1;
245 printf("Quit requested\n"); 251 printf ("Quit requested\n");
246 return(0); 252 return (0);
247 } 253 }
248 printf("Quit demanded\n"); 254 printf ("Quit demanded\n");
249 return(1); 255 return (1);
250 256
251 /* This will never happen because events queued directly 257 /* This will never happen because events queued directly
252 to the event queue are not filtered. 258 to the event queue are not filtered.
253 */ 259 */
254 case SDL_USEREVENT: 260 case SDL_USEREVENT:
255 return(1); 261 return (1);
256 262
257 /* Drop all other events */ 263 /* Drop all other events */
258 default: 264 default:
259 return(0); 265 return (0);
260 } 266 }
261 } 267 }
262 268
263 int main(int argc, char *argv[]) 269 int
264 { 270 main (int argc, char *argv[])
265 SDL_Event event; 271 {
266 char *title; 272 SDL_Event event;
267 SDL_Surface *icon; 273 char *title;
268 Uint8 *icon_mask; 274 SDL_Surface *icon;
269 int parsed; 275 Uint8 *icon_mask;
270 int w, h; 276 int parsed;
271 277 int w, h;
272 if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) { 278
273 fprintf(stderr, 279 if (SDL_Init (SDL_INIT_VIDEO) < 0) {
274 "Couldn't initialize SDL: %s\n", SDL_GetError()); 280 fprintf (stderr, "Couldn't initialize SDL: %s\n", SDL_GetError ());
275 return(1); 281 return (1);
276 } 282 }
277 283
278 /* Check command line arguments */ 284 /* Check command line arguments */
279 w = 640; 285 w = 640;
280 h = 480; 286 h = 480;
281 video_bpp = 8; 287 video_bpp = 8;
282 video_flags = SDL_SWSURFACE; 288 video_flags = SDL_SWSURFACE;
283 parsed = 1; 289 parsed = 1;
284 while ( parsed ) { 290 while (parsed) {
285 if ( (argc >= 2) && (strcmp(argv[1], "-fullscreen") == 0) ) { 291 if ((argc >= 2) && (strcmp (argv[1], "-fullscreen") == 0)) {
286 video_flags |= SDL_FULLSCREEN; 292 video_flags |= SDL_FULLSCREEN;
287 argc -= 1; 293 argc -= 1;
288 argv += 1; 294 argv += 1;
289 } else 295 } else if ((argc >= 2) && (strcmp (argv[1], "-resize") == 0)) {
290 if ( (argc >= 2) && (strcmp(argv[1], "-resize") == 0) ) { 296 video_flags |= SDL_RESIZABLE;
291 video_flags |= SDL_RESIZABLE; 297 argc -= 1;
292 argc -= 1; 298 argv += 1;
293 argv += 1; 299 } else if ((argc >= 2) && (strcmp (argv[1], "-noframe") == 0)) {
294 } else 300 video_flags |= SDL_NOFRAME;
295 if ( (argc >= 2) && (strcmp(argv[1], "-noframe") == 0) ) { 301 argc -= 1;
296 video_flags |= SDL_NOFRAME; 302 argv += 1;
297 argc -= 1; 303 } else if ((argc >= 3) && (strcmp (argv[1], "-width") == 0)) {
298 argv += 1; 304 w = atoi (argv[2]);
299 } else 305 argc -= 2;
300 if ( (argc >= 3) && (strcmp(argv[1], "-width") == 0) ) { 306 argv += 2;
301 w = atoi(argv[2]); 307 } else if ((argc >= 3) && (strcmp (argv[1], "-height") == 0)) {
302 argc -= 2; 308 h = atoi (argv[2]);
303 argv += 2; 309 argc -= 2;
304 } else 310 argv += 2;
305 if ( (argc >= 3) && (strcmp(argv[1], "-height") == 0) ) { 311 } else if ((argc >= 3) && (strcmp (argv[1], "-bpp") == 0)) {
306 h = atoi(argv[2]); 312 video_bpp = atoi (argv[2]);
307 argc -= 2; 313 argc -= 2;
308 argv += 2; 314 argv += 2;
309 } else 315 } else {
310 if ( (argc >= 3) && (strcmp(argv[1], "-bpp") == 0) ) { 316 parsed = 0;
311 video_bpp = atoi(argv[2]); 317 }
312 argc -= 2; 318 }
313 argv += 2; 319
314 } else { 320 /* Set the icon -- this must be done before the first mode set */
315 parsed = 0; 321 icon = LoadIconSurface ("icon.bmp", &icon_mask);
316 } 322 if (icon != NULL) {
317 } 323 SDL_WM_SetIcon (icon, icon_mask);
318 324 }
319 /* Set the icon -- this must be done before the first mode set */ 325 if (icon_mask != NULL)
320 icon = LoadIconSurface("icon.bmp", &icon_mask); 326 free (icon_mask);
321 if ( icon != NULL ) { 327
322 SDL_WM_SetIcon(icon, icon_mask); 328 /* Set the title bar */
323 } 329 if (argv[1] == NULL)
324 if ( icon_mask != NULL ) 330 title = "Testing 1.. 2.. 3...";
325 free(icon_mask); 331 else
326 332 title = argv[1];
327 /* Set the title bar */ 333 SDL_WM_SetCaption (title, "testwm");
328 if ( argv[1] == NULL ) 334
329 title = "Testing 1.. 2.. 3..."; 335 /* See if it's really set */
330 else 336 SDL_WM_GetCaption (&title, NULL);
331 title = argv[1]; 337 if (title)
332 SDL_WM_SetCaption(title, "testwm"); 338 printf ("Title was set to: %s\n", title);
333 339 else
334 /* See if it's really set */ 340 printf ("No window title was set!\n");
335 SDL_WM_GetCaption(&title, NULL); 341
336 if ( title ) 342 /* Initialize the display */
337 printf("Title was set to: %s\n", title); 343 if (SetVideoMode (w, h) < 0) {
338 else 344 quit (1);
339 printf("No window title was set!\n"); 345 }
340 346
341 /* Initialize the display */ 347 /* Set an event filter that discards everything but QUIT */
342 if ( SetVideoMode(w, h) < 0 ) { 348 SDL_SetEventFilter (FilterEvents);
343 quit(1); 349
344 } 350 /* Ignore key up events, they don't even get filtered */
345 351 SDL_EventState (SDL_KEYUP, SDL_IGNORE);
346 /* Set an event filter that discards everything but QUIT */ 352
347 SDL_SetEventFilter(FilterEvents); 353 /* Loop, waiting for QUIT */
348 354 while (SDL_WaitEvent (&event)) {
349 /* Ignore key up events, they don't even get filtered */ 355 switch (event.type) {
350 SDL_EventState(SDL_KEYUP, SDL_IGNORE); 356 case SDL_VIDEORESIZE:
351 357 printf ("Got a resize event: %dx%d\n",
352 /* Loop, waiting for QUIT */ 358 event.resize.w, event.resize.h);
353 while ( SDL_WaitEvent(&event) ) { 359 SetVideoMode (event.resize.w, event.resize.h);
354 switch (event.type) { 360 break;
355 case SDL_VIDEORESIZE: 361 case SDL_USEREVENT:
356 printf("Got a resize event: %dx%d\n", 362 printf ("Handling internal quit request\n");
357 event.resize.w, event.resize.h); 363 /* Fall through to the quit handler */
358 SetVideoMode(event.resize.w, event.resize.h); 364 case SDL_QUIT:
359 break; 365 printf ("Bye bye..\n");
360 case SDL_USEREVENT: 366 quit (0);
361 printf("Handling internal quit request\n"); 367 default:
362 /* Fall through to the quit handler */ 368 /* This should never happen */
363 case SDL_QUIT: 369 printf ("Warning: Event %d wasn't filtered\n", event.type);
364 printf("Bye bye..\n"); 370 break;
365 quit(0); 371 }
366 default: 372 }
367 /* This should never happen */ 373 printf ("SDL_WaitEvent() error: %s\n", SDL_GetError ());
368 printf("Warning: Event %d wasn't filtered\n", 374 SDL_Quit ();
369 event.type); 375 return (255);
370 break; 376 }
371 }
372 }
373 printf("SDL_WaitEvent() error: %s\n", SDL_GetError());
374 SDL_Quit();
375 return(255);
376 }