Mercurial > sdl-ios-xcode
comparison test/testsprite.c @ 5188:1425cff805f0
Allow resizing of testsprite
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Fri, 04 Feb 2011 21:46:38 -0800 |
parents | 27ab20a36eba |
children |
comparison
equal
deleted
inserted
replaced
5187:d976b67150c5 | 5188:1425cff805f0 |
---|---|
170 fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError()); | 170 fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError()); |
171 return (1); | 171 return (1); |
172 } | 172 } |
173 | 173 |
174 numsprites = NUM_SPRITES; | 174 numsprites = NUM_SPRITES; |
175 videoflags = SDL_SWSURFACE | SDL_ANYFORMAT; | 175 videoflags = SDL_SWSURFACE | SDL_ANYFORMAT | SDL_RESIZABLE; |
176 width = 640; | 176 width = 640; |
177 height = 480; | 177 height = 480; |
178 video_bpp = 8; | 178 video_bpp = 8; |
179 debug_flip = 0; | 179 debug_flip = 0; |
180 while (argc > 1) { | 180 while (argc > 1) { |
295 while (!done) { | 295 while (!done) { |
296 /* Check for events */ | 296 /* Check for events */ |
297 ++frames; | 297 ++frames; |
298 while (SDL_PollEvent(&event)) { | 298 while (SDL_PollEvent(&event)) { |
299 switch (event.type) { | 299 switch (event.type) { |
300 case SDL_VIDEORESIZE: | |
301 screen = SDL_SetVideoMode(event.resize.w, event.resize.h, video_bpp, videoflags); | |
302 break; | |
300 case SDL_MOUSEBUTTONDOWN: | 303 case SDL_MOUSEBUTTONDOWN: |
301 SDL_WarpMouse(screen->w / 2, screen->h / 2); | 304 SDL_WarpMouse(screen->w / 2, screen->h / 2); |
302 break; | 305 break; |
303 case SDL_KEYDOWN: | 306 case SDL_KEYDOWN: |
304 /* Any keypress quits the app... */ | 307 /* Any keypress quits the app... */ |