Bindings
Bindings are how you attach commands to user inputs or other events.
Mercurial uses the BoundBooleanSupplier
system to provide bindings, which is
a thin wrapper over
EnhancedBooleanSupplier.
Go read its documentation for more information.
Go look at gamepads for more information on the first line of these examples.
A BoundBooleanSupplier can be easily built from a BoundDoubleSupplier
which is
a thin wrapper over
EnhancedDoubleSupplier.
This is done by using the same conditional system built into
EnhancedDoubleSuppliers
.
The Mercurial gamepads use these for sticks and triggers.
Both of these classes can be easily constructed:
Cool! Bindings is pretty easy, consider building bindings to events both internal and external to your system, like changes in internal state, or changes in sensor values, to perform a larger amount of automation when it comes to commands.