Advertisement Jump to content


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


SDL: key sym is always 0

This topic is 6344 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 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 ? [Edited by - cmdkeen on May 19, 2008 8:44:54 PM]

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!