Keys & Impressed

Hi Guys
Just thought i would say i am impressed again with the thought
that’s gone into SDL, as i am mucking about with keys etc and i have just
noticed that you have mapped the keys to ASCII (nice) also the KMOD defines
for SDL_GetModState also very handy.

looking at the SDLK definitions, thinking that i would be able to pull the
ASCII from the key press, its all good except i am only getting the lower
case key and none of the shift +_}{ etc… so i am assuming that i must use
SDL_GetModState no problem but once i have determined its the shift or caps
has been pressed, how can i translate the ASCII to the Shifted version?

MyASCII = event.key.keysym.sym; // this does not work for uppercase and {}
etc

Thanks again.
Trish

Hi Guys

    Just thought i would say i am impressed again with the thought

that’s gone into SDL, as i am mucking about with keys etc and i have just
noticed that you have mapped the keys to ASCII (nice) also the KMOD defines
for SDL_GetModState also very handy.

looking at the SDLK definitions, thinking that i would be able to pull the
ASCII from the key press, its all good except i am only getting the lower
case key and none of the shift +_}{ etc… so i am assuming that i must use
SDL_GetModState no problem but once i have determined its the shift or caps
has been pressed, how can i translate the ASCII to the Shifted version?

MyASCII = event.key.keysym.sym; // this does not work for uppercase and {}
etc

Thanks again.

Trish

You will want something like the OnKeyDownTranslate() routine I put up on my
website here:

HYPERLINK
"http://www.homebrewsoftware.com/CodeSamples/OnKeyDownTranslate.cpp"http://w
ww.homebrewsoftware.com/CodeSamples/OnKeyDownTranslate.cpp

Please understand that this is what you need to translate shift and caps
keys. If you need additional key translation (Function keys, Alt keys etc.)
you will need to add that support.

I hope that helps.

Ken Rogoway

Homebrew Software

HYPERLINK "http://www.homebrewsoftware.com/"http://www.homebrewsoftware.com/From: sdl-bounces@lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org] On
Behalf Of Patricia Curtis
Sent: Saturday, March 24, 2007 1:50 PM
To: sdl at libsdl.org
Subject: [SDL] Keys & Impressed



No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.17/732 - Release Date: 3/24/2007
4:36 PM


No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.17/732 - Release Date: 3/24/2007
4:36 PM

Patricia Curtis wrote:

Hi Guys
Just thought i would say i am impressed again with the thought
that’s gone into SDL, as i am mucking about with keys etc and i have just
noticed that you have mapped the keys to ASCII (nice) also the KMOD defines
for SDL_GetModState also very handy.

Never use keysyms for text input. Always use the unicode field.–
Rainer Deyke - rainerd at eldwood.com

Behalf Of Rainer Deyke

Patricia Curtis wrote:

Hi Guys
Just thought i would say i am impressed again with the thought
that’s gone into SDL, as i am mucking about with keys etc and i have just
noticed that you have mapped the keys to ASCII (nice) also the KMOD
defines
for SDL_GetModState also very handy.

Never use keysyms for text input. Always use the unicode field.


Rainer Deyke - rainerd at eldwood.com

If you are going to use Unicode then make sure you enable it by calling:

SDL_EnableUNICODE(int enable);

http://www.libsdl.org/cgi/docwiki.cgi/SDL_5fEnableUNICODE

Ken Rogoway
Homebrew Software
http://www.homebrewsoftware.com/


No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.17/732 - Release Date: 3/24/2007
4:36 PM

----- Original Message -----
From: sdl-bounces@lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org] On
Sent: Saturday, March 24, 2007 3:39 PM
To: sdl at libsdl.org
Subject: Re: [SDL] Keys & Impressed