InputMapper doesn't register 2 FunctionIDs on 1 key?

If I want to assign a custom FunctionID to “Space” (which already has the UINavigation:Activate FunctionID) then the latter gets processed but not the former ( i.e. valueChanged is not called). To avoid this, I need to use a key which isn’t already assigned to UINavigation:Activate.

Any advice? Thanks!

EDIT: I do this, maybe it’s related?

    GuiGlobals.getInstance().getInputMapper().addStateListener(this, FocusNavigationFunctions.F_ACTIVATE);

EDIT 2: No, commenting that line avoid processing of Activate but still won’t process my custom FunctionID

You should be able to register multiple functions to one key as long as they are in different groups. The active group should be the one that gets the event.

…and I know this works because in my games I can use the same keys to navigate the UI that I use to turn the camera (cursor keys). With the navigation only active when the UI is and camera keys only active when its not sort of thing.

2 Likes

Thanks, this did the trick!

GuiGlobals.getInstance().getInputMapper().deactivateGroup(UI_NAV);

But at the same time, I suspect the “real error” is somewhere else… but at least now I have a better understanding on what’s going on.

1 Like

I’m almost there. To cleanly add and remove analog listener, I need to do… things:

        for (InputMapper.Mapping m : GuiGlobals.getInstance().getInputMapper().getMappings(LEFT_STICK_Y)){
            GuiGlobals.getInstance().getInputMapper().removeMapping(m);
        }

Am I doing something wrong?

That’s not removing an analog listener. That’s removing a mapping. To remove an analog listener then you’d call removeAnalogListener().

The fact that your function ID is called “LEFT_STICK_Y” already makes me think that you might be using function IDs incorrectly. These are supposed to be logical functions in your game. “Jump”, “WalkForward”, “WalkSideways”, “Shoot”, whatever. Not just other names for the inputs.

1 Like

Indeed. But until I can use the LWJGL gamepad API into Inputmanager, and plug it into Lemur, that’s the (hacky) way.