Nifty key bindings


I try to stop that bloody nifty from hooking on the TAB key and it drives me nuts

  • first, if I want to setup an inputMapping to my screen, I need the screen controller to implement KeyInputHandler otherwise I get some error, it does not make any sens, but whatever…
        <screen id="Hud" controller="mygame.appstates.HudAppState" inputMapping="mygame.gui.MyNiftyInputMapping">
  • then it just dont work at all, I return a null object, so nifty should not bother wit inputs anymore but it does
    for some reason it creates NiftyInputEvent from thin air

  • convert() is called AFTER the button focus is switched to the next one

   public NiftyInputEvent convert(KeyboardInputEvent inputEvent) 
        return null; <<<<<<<< to make sure nifty dont process events

TAB keeps focusing buttons after buttons

    <controlDefinition name="keyBindingComponent">
        <panel childLayout="horizontal" backgroundColor="#ffffff33" padding="5px" height="30">
            <control width="20%" id="#bindingButton" name="button" label="$bindingText">
                <interact onClick="$action"/>
        <layer id="settingsLayer" childLayout="center" backgroundColor="#0000">
            <panel width="400" height="400" childLayout="vertical">
                <control name="keyBindingComponent" bindingDesc="forward" bindingText="???" action="DefineKeyBinding(forward)"/>
                <control name="keyBindingComponent" bindingDesc="backward" bindingText="???" action="DefineKeyBinding(backward)"/>
                <control name="keyBindingComponent" bindingDesc="left" bindingText="???" action="DefineKeyBinding(left)"/>
                <control name="keyBindingComponent" bindingDesc="right" bindingText="???" action="DefineKeyBinding(right)"/>

any advice ?


ok, found the answer
a gui system sends events to its bottom children nodes first
so to make this work, I had to add inputMapping to the button themself, not the screen
well at least so far it seems to work :slight_smile: