How to extend InputMapper

I want to extend GuiGlobals to make my library work with standard Lemur:

import com.jme3.app.Application;
import com.simsilica.lemur.GuiGlobals;

public class BBGuiGlobals extends GuiGlobals {
    BBInputMapper bbinputMapper;

    public BBGuiGlobals(Application app, BBInputMapper bbinputMapper) {
        super(app);
        this.bbinputMapper = bbinputMapper;
    }

    public InputMapper getInputMapper() {
        return bbinputMapper;
    }
}

---

package com.simsilica.lemur.input;

import com.jme3.input.InputManager;

public class BBInputMapper extends InputMapper{

    public BBInputMapper(InputManager inputManager) {
        super(inputManager);
    }

    public void bbnotifyStateChanged(FunctionId f, float tpf, InputState is){
        getFunctionListeners(f,false).notifyStateChanged(f, is);
    }
}

---

    protected void initialize(Application app) {
        inputMapper = new BBInputMapper(getApplication().getInputManager());
        GuiGlobals.setInstance(new BBGuiGlobals(getApplication(), inputMapper));



However, while the above code succeeds in compiling and kinda work, there are some problems:

  • theming don’t work
  • input navigation don’t work

Any suggestion is appreciated, thanks!

Can you be more specific about how it doesn’t work?

The sample app included in BigBanana should look like this

but instead look like this

and keyboard navigation don’t work

As to the first problem, it seems that it can’t locate the built in glass style… so classpath shenanigans or classloader shenanigans.

As to the second problem, since you’ve completely replaced JME’s InputManager, it might be worth confirming that the same keyboard events are still being sent to the RawInputListener… else the navigation functionIDs will never be triggered, maybe.

Edit: or rather that your own mapping is triggering those functions.