Do you really
need Chinese input? I ask because the vast majority of games I play or even see don't have any input at all apart from keyboard polling.
Short answer: Well I would like to
(Note1: this is all with LWJGL OpenGL frame)
(Note2: I am not that good with keyboards, just trying to figure out.)
Basically we have a non-standard keyboard (mine (hungarian)), let just concentrate on two keys on this keyboard:
Shift: thank god, its there where it has to be
(standard) "z": oops, this for weird reason is swapped with the "y" key
My goal is to:
Enable to the user to set his keys used in the game to whatever he wants.
Let's see what happens when the user presses the "z" key:
LWJGL returns the keyboard scan code
(look at the table not the image): 44="z"=(0x2C) (Keyboard.getEventKey())
and the localised character 121="y" (Keyboard.getEventCharacter())
AWT KeyEvent (which AFAIK does NOT work in the LWJGL frame) returns:
Java-inner code 89 (KeyEvent.VK_Y)
and ascii code 121="y"
Oookey, now lets look at the problem.
We have 2 possibilities: Setup in the LWJGL-frame in game, or create an AWT/Swing setup frame, and after the user presses the "Play" button, the LWJGL frame starts.
-Can I use the scan code? Well, this way internationalised keyboards will never be recognised (i.e. when I press "y", it will say I pressed "z"). Not the best idea, but oh well...
-Can I use character? No becouse If I use "shift" as for example Shoot, and "y" to left, than the character code may be sometimes 121="y" (when Im not shooting), and sometimes 89="Y" (when Im shooting).
-Both? The user presses the key, I save the scan code, but print the character to the screen. But what happens when the shift is pressed/caps lock is on? the user will see different characters for the same key ("y", "Y"). And what when the user changes the locale settings in the OS?
new Frame mode:
-character? see above
-Java inner code? It cannot be assigned to a LWJGL code.
Problem complicates when I want the user to write his name/level code/chat with the non-standard keys...
What I would like to see?
1. maybe to convert keyboard scan-code to (lower case) localised character. Is there anything for this in Java?
2. Use AWT Keyboard handling in LWJGL frame. It does not seem to work, even the Toolkit.addAWTEventListener does not dispatch thoose.
P.S.: Im i overcomplicating the problem?