Mercurial > sdl-ios-xcode
comparison test/threadwin.c @ 562:cb40b26523a5
Added some code to toggle fullscreen and input grab for testing... --ryan.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Fri, 20 Dec 2002 03:37:28 +0000 |
parents | 74212992fb08 |
children | be9c9c8f6d53 |
comparison
equal
deleted
inserted
replaced
561:4bcf7dd06c47 | 562:cb40b26523a5 |
---|---|
170 for ( i=0; i<found; ++i ) { | 170 for ( i=0; i<found; ++i ) { |
171 switch(events[i].type) { | 171 switch(events[i].type) { |
172 /* We want to toggle visibility on buttonpress */ | 172 /* We want to toggle visibility on buttonpress */ |
173 case SDL_KEYDOWN: | 173 case SDL_KEYDOWN: |
174 case SDL_KEYUP: | 174 case SDL_KEYUP: |
175 printf("Key '%c' has been %s\n", | |
176 events[i].key.keysym.unicode, | |
177 (events[i].key.state == SDL_PRESSED) ? | |
178 "pressed" : "released"); | |
179 | |
175 /* Allow hitting <ESC> to quit the app */ | 180 /* Allow hitting <ESC> to quit the app */ |
176 if ( events[i].key.keysym.sym == SDLK_ESCAPE ) { | 181 if ( events[i].key.keysym.sym == SDLK_ESCAPE ) { |
177 done = 1; | 182 done = 1; |
178 } | 183 } |
179 printf("Key '%c' has been %s\n", | 184 |
180 events[i].key.keysym.unicode, | 185 /* skip events now that aren't KEYUPs... */ |
181 (events[i].key.state == SDL_PRESSED) ? | 186 if (events[i].key.state == SDL_PRESSED) |
182 "pressed" : "released"); | 187 break; |
188 | |
189 if ( events[i].key.keysym.sym == SDLK_f ) { | |
190 int rc = 0; | |
191 printf("attempting to toggle fullscreen...\n"); | |
192 rc = SDL_WM_ToggleFullScreen(SDL_GetVideoSurface()); | |
193 printf("SDL_WM_ToggleFullScreen returned %d.\n", rc); | |
194 } | |
195 | |
196 if ( events[i].key.keysym.sym == SDLK_g ) { | |
197 SDL_GrabMode m; | |
198 m = SDL_WM_GrabInput(SDL_GRAB_QUERY) == SDL_GRAB_ON ? | |
199 SDL_GRAB_OFF : SDL_GRAB_ON; | |
200 printf("attempting to toggle input grab to %s...\n", | |
201 m == SDL_GRAB_ON ? "ON" : "OFF"); | |
202 SDL_WM_GrabInput(m); | |
203 printf("attempt finished.\n"); | |
204 } | |
205 | |
183 break; | 206 break; |
184 } | 207 } |
185 } | 208 } |
186 /* Give up some CPU to allow events to arrive */ | 209 /* Give up some CPU to allow events to arrive */ |
187 SDL_Delay(20); | 210 SDL_Delay(20); |