Package com.pocolifo.robobase.control
Class OneTimeControl
java.lang.Object
com.pocolifo.robobase.control.OneTimeControl
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
get()
Get the current toggled state.onToggleOn
(Runnable runnable) Run code when thisOneTimeControl
is toggled ON.Updates this Toggleable.
-
Constructor Details
-
OneTimeControl
Creates aToggleable
.- Parameters:
currentState
- A method to get the current state of something (like whether a gamepad button is pressed)
-
-
Method Details
-
get
public boolean get()Get the current toggled state.- Returns:
- The toggled state of this
OneTimeControl
-
processUpdates
Updates this Toggleable. Should be called ONCE as frequent as possible or in the main loop!- Returns:
- This
OneTimeControl
instance.
-
onToggleOn
Run code when thisOneTimeControl
is toggled ON.- Parameters:
runnable
- ARunnable
that is executed when this toggleable is toggled ON.- Returns:
- This
OneTimeControl
instance.
-