comparison test/threadwin.c @ 3956:3868bebb9f5b SDL-1.2

Print keysym with key events.
author Ryan C. Gordon <icculus@icculus.org>
date Wed, 13 Jun 2007 04:13:21 +0000
parents 290b5baf2fca
children
comparison
equal deleted inserted replaced
3955:40b6b5744e05 3956:3868bebb9f5b
177 for ( i=0; i<found; ++i ) { 177 for ( i=0; i<found; ++i ) {
178 switch(events[i].type) { 178 switch(events[i].type) {
179 /* We want to toggle visibility on buttonpress */ 179 /* We want to toggle visibility on buttonpress */
180 case SDL_KEYDOWN: 180 case SDL_KEYDOWN:
181 case SDL_KEYUP: 181 case SDL_KEYUP:
182 printf("Key '%c' has been %s\n", 182 printf("Key '%c' (keysym==%d) has been %s\n",
183 events[i].key.keysym.unicode, 183 events[i].key.keysym.unicode,
184 (int) events[i].key.keysym.sym,
184 (events[i].key.state == SDL_PRESSED) ? 185 (events[i].key.state == SDL_PRESSED) ?
185 "pressed" : "released"); 186 "pressed" : "released");
186 187
187 /* Allow hitting <ESC> to quit the app */ 188 /* Allow hitting <ESC> to quit the app */
188 if ( events[i].key.keysym.sym == SDLK_ESCAPE ) { 189 if ( events[i].key.keysym.sym == SDLK_ESCAPE ) {