I want to make a control settings panel, where I ask users to press keys they want to use for the different actions. Is there a way to make my Controller receive KeyboardInputEvents instead of NiftyInputEvents, so that I can map them directly to JME KeyTriggers?
Thanks in advance!
You could try using one of the following:
a) [java]de.lessvoid.nifty.screen.Screen.addKeyboardInputHandler(NiftyInputMapping, KeyInputHandler)[/java]
b) [java]de.lessvoid.nifty.screen.Screen.addPreKeyboardInputHandler(NiftyInputMapping, KeyInputHandler)[/java]
You can implement a NiftyInputMapping to transform the incoming KeyBoardInputEvent to a NiftyInputEvent and the KeyInputHandler to take some action depending on that NiftyInputEvent and the character in it.
The mappings and handlers added in b) are processed before those in a).
Perhaps that could work?
It it’s “how JME sees the event” that you ultimately want then it might be easiest to just register a RawInputListener with JME’s InputManager.
Then you get every key and mouse event (that isn’t consumed before you get it) and can do whatever you want with it.
Ok, thank you! I think I’ll try it with the RawInputListener.