Hi
I now added unicode support with SDL_EnableUNICODE(1) and try to process the
events like this:
while(SDL_PollEvent(&Event))
{
switch(Event.type)
{
case SDL_KEYDOWN:
if((Event.key.keysym.unicode & 0xFF80) == 0)
{
char ch = Event.key.keysym.unicode &
0x7F;
if(ch)
m_strText += ch;
}
}
}
The problem is that the variable ch is always zero whatever key I press. Do
you have any idea what I’m doing wrong? (I’ve got WinXP)
greetings
Milo Spirig
-----Urspr?ngliche Nachricht-----Von: sdl-admin at libsdl.org [mailto:sdl-admin at libsdl.org] Im Auftrag von David
Olofson
Gesendet: Freitag, 17. Januar 2003 18:46
An: sdl at libsdl.org
Betreff: Re: [SDL] Reading text from keyboard
On Friday 17 January 2003 15.20, @Milo_Spirig wrote:
Hi
I’m looking for a comfortable possibility to read text from the
keyboard. At the Moment I’m checking for a lot key combinations for
special characters, but that’s really bad, specially because I got a
swiss keyboard… Is there a better way to do this job, I already
tried the SDL input events but it seems they also don’t give you key
combinations (like shift+1, …).
They sure do, but all physical keys are treated as such, regardless
of keymaps and stuff. Think of the keyboard as a gigantic gamepad.
As to your problem, you’re not supposed to do this yourself in an
application, ever. That won’t work with different layouts (like
Dvorak… heh), and it hardcodes your application to a specific
language for no good reason.
Doesn’t UNICODE provide the information you need?
//David Olofson - Programmer, Composer, Open Source Advocate
.- The Return of Audiality! --------------------------------.
| Free/Open Source Audio Engine for use in Games or Studio. | RT and
| off-line synth. Scripting. Sample accurate timing. |
`---------------------------> http://olofson.net/audiality -’
— http://olofson.net — http://www.reologica.se —
SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl