How does localization work in LWJGL?

Started by elias4444, May 18, 2009, 16:36:12

Previous topic - Next topic

elias4444

I'm running into a few issues with localizing my games. I'm sure it's just my lack of understanding of how LWJGL handles different keyboard layouts though.

So far, for English, I setup the first 256 keyboard characters into a texture. This is from my default of en_US. Now, there's a chat system in my game, and so long as people use standard en_US characters 0-255, there's no problem. BUT, if someone with a UK keyboard tries to use something like the euro monetary symbol (which I have no idea how to insert here with my en_US keyboard), they bomb out with an error. How does LWJGL see the different symbols? Since there's no Keyboard.KEY_DOLLAR or KEY_EURO, do they come back as the same getEventChar code? Heck, is the euro symbol even in the same place as the dollar symbol?

=-=-=-=-=-======-=-=-=-=-=-
http://www.tommytwisters.com

princec

The raw keycodes actually refer to the positions of the keys on a "standard" US-centric keyboard layout. The getEventChar() stuff is translated from the raw positional code into the OS-calculated derived character code. getEventChar() should work with dead keys and modifier keys too. This means that if the user types € (AltGr-4) then you should get a Euro symbol in getEventChar(). If you were looking at the raw keycodes you'd get KEY_RMENU and KEY_4 keycodes generally - but this isn't guaranteed; the OS has a nice mapping which takes care of all of that for us.

Cas :)