December 5, 2011, 10:19pm
I have a little question to ask which i couldnt answer myself with neither the docu nor the search.
I want to bind compound keyinputs like Ctrl+W and stuff. So i thought about giving in something like that:
inputManager.addMapping("ShowGui", new KeyTrigger(KeyInput.KEY_LCONTROL), new KeyTrigger(KeyInput.KEY_W));
Obviously it doesnt work. It just reacts when either W or LCtrl is pressed.
So my question is, how do i achieve those "compound" key inputs? Any proper way of doing this?
I don’t know of any inbuilt way to handle this.
In your ActionListener onAction method I would simply set flags for which keys are depressed, then check for both the ‘W’ and ‘LCtrl’ flags before executing your code.
December 5, 2011, 11:02pm
I hoped to avoid such things to be honest. I thought the inputManager had some way to handle this kind of stuff.
Thanks for your answer anyway. Maybe our mighty normen knows an answer later on. Ill just stick with your proposal for now until (if in case anyone knows a smoother way) i get a new answer.
December 5, 2011, 11:50pm
You have to do that logic yourself, you just get information about pressed or unpressed keys. Given that games can have many different input schemes that can vary widely from the normal “Modifier+Key” input and that the solution is easy to implement we think thats the best way.
December 6, 2011, 12:06am
Okay… So i will stick with my actual solution. Thanks, you two