Sign in to follow this  
JeremyCAFE

SDL - Event like WM_CHAR?

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this