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
-
Field Summary
Fields Modifier and Type Field Description private final BooleanhasTimeSensitiveListeners
-
Method Summary
Modifier and Type Method Description final BooleangetHasTimeSensitiveListeners()Property which enables an optimization where the KeyBinder will only update after every frame if there are time-sensitive listeners. final Booleanaccept(Event event)accept a keystroke event. final Booleanaccept(Integer key, Boolean down)accept an unmapped keystroke event. final Booleanupdate(Long deltaTimeNanos, Byte keyModifiers)final UnitcompleteRecording()final Unitadd(KeyBinder.Bind binds)Add a keybind to this PolyUI instance, that will be run when the given keys are pressed. 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(Settings settings)
-
-
Method Detail
-
getHasTimeSensitiveListeners
final Boolean getHasTimeSensitiveListeners()
Property which enables an optimization where the KeyBinder will only update after every frame if there are time-sensitive listeners.
- Since:
1.1.1
-
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 binds)
Add a keybind to this PolyUI instance, that will be run when the given keys are pressed.
- Since:
1.1.7
-
add
final Unit add(KeyBinder.Bind bind)
Add a keybind to this PolyUI instance, that will be run when the given keys are pressed.
- Since:
0.21.0
-
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- Since:
0.24.0
-
cancelRecord
final Unit cancelRecord()
-
-
-
-