jME3 uses LWJGL as a backend. To further explain, in pure LWJGL code, there's this following problem...
char c = Keyboard.getEventCharacter();
char c = (char)29233;
Apparently, this problem duplicates itself in jME3
. Even if you use RawInputListener, to get raw events.
So, I research a little bit. I've found out that this is a bug in java. Microsoft's input method would just return ? for unicode characters. It even happens for TWL. Only pure Java... AWT or Swing input methods will work consistently for unicode input. The only solution is to use AWT or Swing with LWJGL.
Back to jME3, it seems I can't receive events from an attached KeyListener to a canvas to receive its input.
class MyApp extends Application implements KeyListener
JmeCanvasContext ctx = (JmeCanvasContext) getContext();
Canvas canvas = ctx.getCanvas();
Then, I decided to have JTextFields overlay the OpenGL canvas to provide text input, but I found out that it creates more problems. Thus, I abandoned it, in favour of a text field directly in OpenGL instead. I really need unicode textual input as my target application definitely requires handling of East Asian scripts (especially Chinese).How do unicode games (especially those with chatting consoles) get Unicode Input?
- How do you receive a KeyListener event from an OpenGL canvas?
- Is there a better way to do this?
Thanks for the help! =D