press

fun press(button: Button, command: Command)

Sets the command supplier to be executed when the specified Button is pressed.

This overload accepts a supplier of a Command. If the button was previously bound, only the press command is updated; the release command remains unchanged.

Parameters

button

The Button to bind.

command

The Command supplier for the press event.

Example:

press(Button.A, MyCommand())

fun press(button: Button, command: () -> Unit)

Sets the command supplier to be executed when the specified button is pressed.

This overload accepts a lambda of type () -> Unit, which is wrapped in an InstantCommand. Useful for simple actions that do not require a full Command implementation.

Parameters

button

The button to bind.

command

The lambda to execute for the press event.

Example:

press(Button.B) { println("Pressed B!") }