I follow…
Registering more than one KeyInput to a single command is what is not allowed right now in code… I got it backwards. You can’t do this:
keyboard.set("jump", KeyInput.KEY_Y);
keyboard.add("jump", KeyInput.KEY_SPACE);
Only space would work for the above. Which makes sense.
At first I was worried a little about a string compare issue, but now that I realize that it's not based on string compare but rather on the hash value of the string, it's faster.
Then you get a list of KeyInputs and do a compare against the currently down keys. Hmm... ;) still feels backwards. I've always started with which keys are down and then looked up actions. Not the other way around. But that's just me.
I guess it depends on which list is larger.. the actions list which is looped through in the InputHandler or the Keys-that-are-down list which is built in the KeyBindingManager from the list of all available key codes associated with a particular command and the list of commands.
Bottom line for me is that right now you have to have at least 4 lines of code for each bound key (look at FirstPersonHandler).
1 for keyboard.set
1 for creating the action
1 for setting the command value
1 for adding it to the InputHandler
Plus it means at least 2 string copies... not a big deal really since it's during game init.
One of the above can be removed by creating the Action implementation to allow for passing in the command value during construction. Thus also combining two others which would end up being only two lines.
Don't know why I'm such a stickler for lines of code, my German heritage I guess :D.
Since we are limited on how the keyboard interaction works from LWJGL, where we only have one call... isKeyDown, and thus having to check for each key individually then I figure your way probably makes the most sense.
The direct callback to a Method is probably NOT a good idea, sticking with a documented interface via AbstractInputAction is just better design actually.
batman, probably the best solution to your issue is probably extending the KeyBindingManager so that the value part of the HashMap is not just one int value but rather a list. This could be done without changing how any other application works.
From the way I see it you'd add a new method to KeyBindingManager called setMulti that would work like the current set. This would accept an array or some such.
The HashMap's value associated with the command key would be an int array instead of just an int, and the current stuff would be converted to work with an array. set would be converted to add the value into the array, but just one value would be in it.
Then the isValidCommand would check if the array is larger than 1, if it was then instead of just checking if the single key is down, it would check if all the keys are down.
I can do this change for you if you'd like. I don't think anyone would have a problem with that since it wouldn't break anything in existance that I can see. Please correct me if I'm wrong.
now, finally...
suggestions on how UI Button to some Action correlation should work would be appreciated. Right now I am thinking that having a specialized UIInputHandler would be nessicary because the MouseInput handling just doesn't work for what I need to do. I need to allow for the same commands that are associated with an action to be run via the keyboard to be run via mouse clicking on buttons and such.