Editor class

A level for editing text.

Inheritance

Constructors

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.

Properties

ambiancePlaybacks → Map<Ambiance, SoundPlayback>
The playback settings for the list of ambiances.
finalinherited
ambiances → List<Ambiance>
A list of ambiances for this level.
finalinherited
backspaceButton → GameControllerButton
The button that will call the backspace method.
final
backspaceScanCode → ScanCode
The key that will call the backspace method.
final
cancelButton → GameControllerButton
The button that will call cancel.
final
cancelScanCode → ScanCode
The key that will call cancel.
final
commandNextRuns → List<NextRun<Command>>
The times before commands should run next.
finalinherited
commands → Map<String, Command>
The commands this level recognises.
finalinherited
controllerAlphabet → String
The alphabet used when entering text from a controller.
final
controllerAxisDispatcher ↔ ControllerAxisDispatcher
The controller axis dispatcher used by this instance.
latefinal
currentLetter → String
The currently focussed letter.
no setter
doneButton → GameControllerButton
The button that will call onDone.
final
doneScanCode → ScanCode
The key that will call onDone.
final
downButton → GameControllerButton
The button used for moving down in the letter grid.
final
game → Game
The game this level is part of.
finalinherited
hashCode → int
The hash code for this object.
no setterinherited
leftButton → GameControllerButton
The button used for moving left in the grid.
final
music → AssetReference?
The music for this level.
finalinherited
musicSound ↔ Sound?
The playing music.
getter/setter pairinherited
onCancel → void Function()?
The function to call when the escape key is pressed.
final
onDone → void Function(String value)
The method to be called when the enter key is pressed.
final
random → Random
The game's random sound generator.
no setterinherited
randomSoundNextPlays → List<NextRun<RandomSound>>
The times that randomSounds should play next.
finalinherited
randomSoundPlaybacks → Map<RandomSound, SoundPlayback>
The playback settings for the list of randomSounds.
finalinherited
randomSounds → List<RandomSound>
All the random sounds on this level.
finalinherited
rightButton → GameControllerButton
The button used for moving right in the letter grid.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
shiftButton → GameControllerButton
The button for adding capital letters.
final
shiftPressed ↔ bool
Whether or not letters should be capitalised.
getter/setter pair
spaceButton → GameControllerButton
The button that will insert a space character.
final
stoppedCommands → List<NextRun<Command>>
The old command next runs.
finalinherited
text ↔ String
The current text of this editor.
getter/setter pair
typeButton → GameControllerButton
The button used for typing the currently-focussed letter in the letter grid.
final
upButton → GameControllerButton
The button used for moving up in the letter grid.
final

Methods

appendText(String value) → void
Add value to text.
backspace() → void
Delete the previous letter.
cancel() → void
Cancel this editor.
convertChar(String char) → String
Return a char with appropriate conversions applied.
getCommandNextRun(Command command) → NextRun<Command>?
Get the next run value for the given command.
inherited
getRandomSoundNextPlay(RandomSound randomSound) → NextRun<RandomSound>
Get the next run for the given randomSound.
inherited
handleSdlEvent(Event event) → void
Handle text editing events from SDL.
override
moveDown() → void
Move down in the letter grid.
moveInLetterGrid(int amount) → void
Move by the given amount in the letter grid.
moveLeft() → void
Move left in the letter grid.
moveRight() → void
Move right in the letter grid.
moveUp() → void
Move up in the letter grid.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onCover(Level other) → void
What should happen when this level is covered by another level.
inherited
onPop(double? fadeLength) → void
What should happen when this level is popped from a level stack.
inherited
onPush({double? fadeLength}) → void
What should happen when this level is pushed into a level stack.
inherited
onReveal(Level old) → void
What should happen when this level is revealed by another level being popped from on top of it.
inherited
outputText(String string) → void
Output some text.
registerCommand(String name, Command command) → void
Register a command on this level.
inherited
runCommand(Command command) → void
Run the given command.
inherited
scheduleRandomSound(RandomSound sound) → void
Schedule a random sound to play.
inherited
startCommand(String name) → bool
Start the command with the given name.
inherited
stopCommand(String name) → bool
Stop the command with the given name.
inherited
stopCommands(int timeDelta) → void
Remove any commands from the stoppedCommands list that can now be ran again.
inherited
stopPlayback(SoundPlayback playback) → void
Stop playback.
inherited
tick(int timeDelta) → void
Let this level tick.
inherited
tickCommands(int timeDelta) → void
Tick all commandNextRuns.
inherited
tickRandomSounds(int timeDelta) → void
Tick all random sounds.
inherited
toString() → String
A string representation of this object.
inherited
type() → void
Type the currently focussed letter.

Operators

operator ==(Object other) → bool
The equality operator.
inherited