ControllerAxisDispatcher class
A class for linking controller axes to functions.
You can use this class to speed up the task of mapping controller axes to functions.
For example:
final dispatcher = ControllerAxisDispatcher({
GameControllerAxis.triggerLeft:
(double value) => print('Left trigger: $value.')});
Now, from a handleSdlEvent
method:
if (event is ControllerAxisEvent) {
dispatcher.handleAxisValue(event.axis, event.smallValue);
}
For examples of this class in action, see the source code for the Menu and Editor classes.
Constructors
-
ControllerAxisDispatcher(Map<
GameControllerAxis, void Function(double value)> axes, {double axisSensitivity = 0.5, int functionInterval = 400}) - Create an instance.
Properties
-
axes
→ Map<
GameControllerAxis, void Function(double value)> -
The axes that are handled by this instance.
final
- axisSensitivity → double
-
The sensitivity of this class.
final
- functionInterval → int
-
How often (in milliseconds) functions will be called.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
handleAxisValue(
GameControllerAxis axis, double value) → void - Handle an axis value.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited