Editor constructor
Editor({
- required Game game,
- required void onDone(
- String value
- String text = '',
- void onCancel()?,
- String controllerAlphabet = 'abcdefghijklmnopqrstuvwxyz,.' '1234567890' r'!"£$%^&*(){}~\/' "-=_+@'",
- GameControllerButton leftButton = GameControllerButton.dpadLeft,
- GameControllerButton rightButton = GameControllerButton.dpadRight,
- GameControllerButton upButton = GameControllerButton.dpadUp,
- GameControllerButton downButton = GameControllerButton.dpadDown,
- GameControllerButton typeButton = GameControllerButton.rightshoulder,
- GameControllerButton shiftButton = GameControllerButton.a,
- ScanCode doneScanCode = ScanCode.return_,
- GameControllerButton doneButton = GameControllerButton.y,
- ScanCode cancelScanCode = ScanCode.escape,
- GameControllerButton cancelButton = GameControllerButton.leftshoulder,
- GameControllerButton spaceButton = GameControllerButton.b,
- ScanCode backspaceScanCode = ScanCode.backspace,
- GameControllerButton backspaceButton = GameControllerButton.x,
- GameControllerAxis upDownAxis = GameControllerAxis.lefty,
- GameControllerAxis leftRightAxis = GameControllerAxis.rightx,
- GameControllerAxis typeAxis = GameControllerAxis.triggerright,
- GameControllerAxis backspaceAxis = GameControllerAxis.triggerleft,
- int controllerMovementSpeed = 400,
- double controllerAxisSensitivity = 0.5,
- AssetReference? music,
- List<
Ambiance> ? ambiances, - List<
RandomSound> ? randomSounds, - Map<
String, Command> ? commands,
Create an instance.
The upDownAxis value decides which axis will call the moveUp and
moveDown methods.
The leftRightAxis value decides which axis will call the moveLeft and
moveRight methods.
The typeAxis value decides which axis will call the type method.
The backspaceAxis value decides which axis will call the backspace
method.
The controllerAxisSensitivity value decides how sensitive the axis
controls are.
The controllerMovementSpeed value decides how regularly axis controllers
can be used.
The ambiances and randomSounds lists are passed directly to the
Level constructor.
Implementation
Editor({
required super.game,
required this.onDone,
this.text = '',
this.onCancel,
this.controllerAlphabet = 'abcdefghijklmnopqrstuvwxyz,.'
'1234567890'
r'!"£$%^&*(){}~\/'
"-=_+@'",
this.leftButton = GameControllerButton.dpadLeft,
this.rightButton = GameControllerButton.dpadRight,
this.upButton = GameControllerButton.dpadUp,
this.downButton = GameControllerButton.dpadDown,
this.typeButton = GameControllerButton.rightshoulder,
this.shiftButton = GameControllerButton.a,
this.doneScanCode = ScanCode.return_,
this.doneButton = GameControllerButton.y,
this.cancelScanCode = ScanCode.escape,
this.cancelButton = GameControllerButton.leftshoulder,
this.spaceButton = GameControllerButton.b,
this.backspaceScanCode = ScanCode.backspace,
this.backspaceButton = GameControllerButton.x,
final GameControllerAxis upDownAxis = GameControllerAxis.lefty,
final GameControllerAxis leftRightAxis = GameControllerAxis.rightx,
final GameControllerAxis typeAxis = GameControllerAxis.triggerright,
final GameControllerAxis backspaceAxis = GameControllerAxis.triggerleft,
final int controllerMovementSpeed = 400,
final double controllerAxisSensitivity = 0.5,
super.music,
super.ambiances,
super.randomSounds,
super.commands,
}) : _shiftPressed = false,
_currentPosition = 0 {
controllerAxisDispatcher = ControllerAxisDispatcher(
{
upDownAxis: (final value) {
if (value > 0) {
moveDown();
} else {
moveUp();
}
},
leftRightAxis: (final value) {
if (value > 0) {
moveRight();
} else {
moveLeft();
}
},
typeAxis: (final value) => type(),
backspaceAxis: (final value) => backspace()
},
axisSensitivity: controllerAxisSensitivity,
functionInterval: controllerMovementSpeed,
);
}