GameLoopAnalogInput class
A collection of analog input buttons
class GameLoopAnalogInput { final GameLoop gameLoop; final Map<int, GameLoopAnalogButton> buttons = new Map<int, GameLoopAnalogButton>(); /** Create a digital input that supports all buttons in buttonIds. */ GameLoopAnalogInput(this.gameLoop, List<int> buttonIds) { for (int buttonId in buttonIds) { buttons[buttonId] = new GameLoopAnalogButton(buttonId); } } /** The time the button was updated. */ double timeUpdated(int buttonId) { GameLoopAnalogButton button = buttons[buttonId]; if (button == null) { return 0.0; } return button.time; } /** The frame the button was updated. */ int frameUpdated(int buttonId) { GameLoopAnalogButton button = buttons[buttonId]; if (button == null) { return 0; } return button.frame; } /** The value of [buttonId]. */ double value(int buttonId) { GameLoopAnalogButton button = buttons[buttonId]; if (button == null) { return 0.0; } return button.value; } }
Constructors
Properties
final Map<int, GameLoopAnalogButton> buttons #
buttons = new Map<int, GameLoopAnalogButton>()
Methods
int frameUpdated(int buttonId) #
The frame the button was updated.
int frameUpdated(int buttonId) { GameLoopAnalogButton button = buttons[buttonId]; if (button == null) { return 0; } return button.frame; }
double timeUpdated(int buttonId) #
The time the button was updated.
double timeUpdated(int buttonId) { GameLoopAnalogButton button = buttons[buttonId]; if (button == null) { return 0.0; } return button.time; }
double value(int buttonId) #
The value of buttonId.
double value(int buttonId) { GameLoopAnalogButton button = buttons[buttonId]; if (button == null) { return 0.0; } return button.value; }