• Advertisement


This topic is now archived and is closed to further replies.

SDL: key sym is always 0

This topic is 6076 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hello, I''m fiddling around with SDL. Everything works fine unless keyboard input. I want the prog to exit when ''esc'' is pressed. But when I poll a keydown event the key''s keysym.sy is always 0. [cpp] while( !bQuit ) { // handle all events while( SDL_PollEvent( &sdlEvent ) ) { switch( sdlEvent.type ) { // a key is pressed case SDL_KEYDOWN: case SDL_KEYUP: switch( sdlEvent.key.keysym.sym ) { // does not work ! ...sym is always 0 if( sdlEvent.key.keysym.sym == SDLK_TAB ) bQuit = true; // does work if( sdlEvent.key.type == SDL_KEYUP ) bQuit = true; break; //... } } [/cpp] sdlEvent.key.keysym.sym is alway 0. sdlEvent.key.keysym.scancode is always valid but I cant recognize all keys with that. Can anyone help me out on this ? http://www.turtlegame.f2s.com [Edited by - cmdkeen on May 19, 2008 8:44:54 PM]

Share this post

Link to post
Share on other sites

  • Advertisement