[input] how to map action to shift-click (two triggers fired together)

Hi,

I’m developing a simple game and right now am trying to implement some simple input (like ‘l-click’ for select, ‘r-click’ for default action, etc) and was wondering if there is a way to map an action so that is invoked after, say, l-click while holding shift key.

My first thought was a kind of complex trigger, something like:
inputManager.addMapping("my Action", new AndTrigger(new KeyTrigger(KeyInput.KEY_LSHIFT), MouseButtonTrigger(MouseInput.BUTTON_LEFT));

And I’m also pretty sure you can cook something up using RawInputListeners, but I thought that before I start making some hacks I’d better ask:

Is there some built-in solution to this ‘shift-clicking’ scenario? Or has any of you stumbled upon this issue and already created some nice workaround?

If you download Lemur and include it in your project then you can use its InputMapper which allows mapping actions to combos. Useful even if you don’t use the rest of its GUI stuff.

http://hub.jmonkeyengine.org/forum/board/projects/lemur/

@RemboL said: inputManager.addMapping("my Action", new AndTrigger(new KeyTrigger(KeyInput.KEY_LSHIFT), MouseButtonTrigger(MouseInput.BUTTON_LEFT));
This will actually trigger myAction when you either left shift or the left mouse button.

You have to decompose in 2 actions, like “shift” action for shift and myAction for LMB.
in shift action you need to set a boolean to true, and check this boolean value when myAction is called…

Or you can use Lemur :stuck_out_tongue:

@pspeed, maybe we could integrate what you did for inputManagement in Lemur to the core…as you did for the BaseAppState.