Heads up!
Added in Fzzy Config 0.6.5
A simple keybind implementation of context handling as explained in Context Actions. This is used inside Fzzy Config to handle screen inputs made to the Config GUI, but it can be purposed for any input made by the user in screens or otherwise.
Heads up!
Keybinds made this way do NOT automatically work. They have to be wired up to something! They are a framework for receiving inputs, alongside the context handler system.
FzzyKeybind
This system starts with the FzzyKeybind 🗗 interface. It implements ContextAction.Relevant
, making it compatible with the Fzzy Config context handling system.
Fzzy keybinds work with modifier keys (ctrl, shift, and/or alt), and also compound together (multiple choice keybinds).
Keybinds have a Builder
:
//this compound keybind accepts either ctrl-Tab or Keypad + as inputs.public FzzyKeybind keybind = (new FzzyKeybind.Builder()).keyboard(GLFW.GLFW_KEY_TAB, true, false, false).keyboard(GLFW.GLFW_KEY_KP_ADD).build();//this keybind can be passed into the context type registry for automatic handling (or used separately of course).public ContextType keybindType = ContextType.create("my.keybind.id", ContextInput.KEYBOARD, keybind);
Validation
ValidatedKeybind
validated FzzyKeyind
; it also implements ContextType.Relevant
so they can be used in the ContextType
registry. This allows for construction of configurable keybinds.
//keybind with built-in validation and GUI configuration support. Can be registered to the context type registry just like above.public ValidatedKeybind myKeybind = new ValidatedKeybind(GLFW.GLFW_KEY_TAB, true, false, false);//there are multiple constructor overloads, including one that lets you operate on a provided Builder for construction of compound keybinds.public ValidatedKeybind myCompoundKeybind = new ValidatedKeybind(builder -> builder.keyboard(GLFW.GLFW_KEY_TAB, true, false, false).keyboard(GLFW.GLFW_KEY_KP_ADD));
Heads up!
See the documentation page here 🗗