SDL digest, Vol 1 #446 - 7 msgs

Hi:
I’m programming a BangBang clone, so I need to ask the user the angle and speed. However, I can’t make
the numeric keyboard work. Here’s a fragment of code about what I’m trying to achieve:

case SDL_KEYDOWN:
char ch;
if ( (event.key.keysym.unicode & 0xFF80) == 0 ) {
ch = event.key.keysym.unicode & 0x7F;
cout << ch;
if(isdigit(ch))
MessageBeep(0);
}
It beeps with the numbers over the letter keys, but it doesn’t with the rightmost numbers. Unicode
translation is ON, NumLock doesn’t make a difference and the sym path (assuming ascii) doesn’t work
either.

Thanks, Bruno Mart?nez

Which characters DOES it return when you press the numpad keys?

RK.

I don’t know the name but it’s that square that belongs to poker cards. It’s the same for all num-keys. It maybe different on other computers since I’ve
got a Spanish keyboard and live in South America. All’s properly configured anduer windows, tough (WinXP).

SDL_EnableUNICODE(1);
then use the keysym.unicode for the character…
read the SDL_keysym docs for how to trim the 16bit unicode down to ASCII.

then with numlock on you should get numbers…


-==-
Jon Atkins
http://jonatkins.org/

Please, read my original message. All the things you advice are there. ALL of them.

Bruno Mart?nez

Bruno Mart?nez wrote:

Which characters DOES it return when you press the numpad keys?

I don’t know the name but it’s that square that belongs to poker cards. It’s the same for all num-keys. It maybe different on other computers since I’ve
got a Spanish keyboard and live in South America. All’s properly configured anduer windows, tough (WinXP).

Please tell me the NUMERIC value of fields in the ‘keysym’ structure in
the event for a few numpad keys.

BTW, it’s annoying when people reply to digests instead of in the
thread. Plz avoid if you can. 10q.

RK.