Class KeyBinder
-
- All Implemented Interfaces:
public final class KeyBinderKeyBinder handles key bindings for the PolyUI instance.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classKeyBinder.Bind
-
Method Summary
Modifier and Type Method Description final Booleanaccept(Event event)accept a keystroke event. final Booleanaccept(Integer key, Boolean down)accept an unmapped keystroke event. final Booleanupdate(Long deltaTimeNanos)final UnitcompleteRecording()final Unitadd(KeyBinder.Bind bind)Add a keybind to this PolyUI instance, that will be run when the given keys are pressed. final Unitremove(KeyBinder.Bind bind)final CompletableFuture<KeyBinder.Bind>record(Long holdDurationNanos, Function0<Boolean> function)Begin recording for a keybind. final UnitcancelRecord()-
-
Constructor Detail
-
KeyBinder
KeyBinder(PolyUI polyUI)
-
-
Method Detail
-
accept
@ApiStatus.Internal() final Boolean accept(Event event)
accept a keystroke event. This will call all keybindings that match the event.
This method is public, but marked as internal. This is because it should only be called by the PolyUI instance, unless you are trying to externally force a keypress (which you probably shouldn't be)
-
accept
@ApiStatus.Internal() final Boolean accept(Integer key, Boolean down)
accept an unmapped keystroke event. This will call all keybindings that match the event.
This method is public, but marked as internal. This is because it should only be called by the PolyUI instance, unless you are trying to externally force a keypress (which you probably shouldn't be)
-
completeRecording
@ApiStatus.Internal() final Unit completeRecording()
-
add
final Unit add(KeyBinder.Bind bind)
Add a keybind to this PolyUI instance, that will be run when the given keys are pressed.
-
remove
final Unit remove(KeyBinder.Bind bind)
-
record
final CompletableFuture<KeyBinder.Bind> record(Long holdDurationNanos, Function0<Boolean> function)
Begin recording for a keybind. This will return a CompletableFuture that will complete when the keybind is recorded.
The keybind will be registered when the CompletableFuture completes.
- Parameters:
holdDurationNanos- the duration that the keys have to be pressed in the resultant keybindfunction- the function that will be run when the keybind is pressed
-
cancelRecord
final Unit cancelRecord()
-
-
-
-