Jump to content
  • Advertisement
Sign in to follow this  
JeremyCAFE

SDL - Event like WM_CHAR?

This topic is 4287 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

I was just wondering if there is an even with SDL that acts like WM_CHAR. I know of the keydown and keyup, but both of those are buffered and do not work as well for text based input.

Share this post


Link to post
Share on other sites
Advertisement
SDL has the ability to get the uncode value of the key pressed:


//Enable Unicode
SDL_EnableUNICODE( SDL_ENABLE );

//While there's events to handle
while( SDL_PollEvent( &event ) )
{

//If a key was pressed
if( event.type == SDL_KEYDOWN )
{

//If the key is a space
if( event.key.keysym.unicode == (Uint16)' ' )
{
//space was pressed
}

}

}



I have an example of it being used for text input here.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!