press
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())
Content copied to clipboard
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!") }
Content copied to clipboard