Menu class
A menu.
Menus hold lists of MenuItem instances, and can be moved through with the up and down methods.
The currently focussed menu item can be accessed with the currentMenuItem member, and activated with the activate method.
If it is possible to cancel from this menu, you can do so with the cancel method.
Constructors
-
Menu({required Game game, required Message title, List<
MenuItem> ? items, int? position, TaskFunction? onCancel, ScanCode upScanCode = ScanCode.up, GameControllerButton upButton = GameControllerButton.dpadUp, ScanCode downScanCode = ScanCode.down, GameControllerButton downButton = GameControllerButton.dpadDown, ScanCode activateScanCode = ScanCode.space, GameControllerButton activateButton = GameControllerButton.dpadRight, ScanCode cancelScanCode = ScanCode.escape, GameControllerButton cancelButton = GameControllerButton.dpadLeft, GameControllerAxis movementAxis = GameControllerAxis.lefty, GameControllerAxis activateAxis = GameControllerAxis.triggerright, GameControllerAxis cancelAxis = GameControllerAxis.triggerleft, int controllerMovementSpeed = 500, double controllerAxisSensitivity = 0.5, bool searchEnabled = true, int searchInterval = 500, SoundChannel? soundChannel, AssetReference? music, List<Ambiance> ? ambiances, List<RandomSound> ? randomSounds, Map<String, Command> ? commands, RumbleEffect? titleRumbleEffect, RumbleEffect? itemRumbleEffect}) - Create a menu.
Properties
- activateButton → GameControllerButton
-
The button that will call the activate method.
final
- activateScanCode → ScanCode
-
The scancode that will call the activate method.
final
-
ambiancePlaybacks
→ Map<
Ambiance, SoundPlayback> -
The playback settings for the list of ambiances.
finalinherited
-
ambiances
→ List<
Ambiance> -
A list of ambiances for this level.
finalinherited
- cancelButton → GameControllerButton
-
The button that will call the cancel method.
final
- cancelScanCode → ScanCode
-
The scancode that will call the cancel method.
final
-
commandNextRuns
→ List<
NextRun< Command> > -
The times before commands should run next.
finalinherited
-
commands
→ Map<
String, Command> -
The commands this level recognises.
finalinherited
- controllerAxisDispatcher ↔ ControllerAxisDispatcher
-
The axis dispatcher used for controller movements.
latefinal
- currentMenuItem → MenuItem?
-
Get the currently focussed menu item.
no setter
- downButton → GameControllerButton
-
The button that will call the down method.
final
- downScanCode → ScanCode
-
The scancode that will call the down method.
final
- game → Game
-
The game this level is part of.
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- itemRumbleEffect → RumbleEffect?
-
The rumble effect to use when moving through the menu.
final
-
The menu items contained by this menu.
final
- music → AssetReference?
-
The music for this level.
finalinherited
- musicSound ↔ Sound?
-
The playing music.
getter/setter pairinherited
- oldSound ↔ Sound?
-
The last sound played by this menu.
getter/setter pair
- onCancel → TaskFunction?
-
The function that will be called by cancel.
final
- position ↔ int?
-
/ The current position in this menu.
getter/setter pair
- 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
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- searchEnabled → bool
-
Whether or not it will be possible to search this menu.
final
- searchInterval → int
-
How many milliseconds must elapse before searches clear searchString.
final
- searchString ↔ String
-
The most recent search string.
getter/setter pair
- searchTime ↔ int
-
The last time a search was performed.
getter/setter pair
- soundChannel → SoundChannel?
-
The sound channel to play sounds through.
final
-
stoppedCommands
→ List<
NextRun< Command> > -
The old command next runs.
finalinherited
- title → Message
-
The title of this menu.
final
- titleRumbleEffect → RumbleEffect?
-
The rumble effect to use when showing the title.
final
- upButton → GameControllerButton
-
The button that will call the up method.
final
- upScanCode → ScanCode
-
The scancode that will call the up method.
final
Methods
-
activate(
) → void - Activate the currently-focused menu item.
-
cancel(
) → void - What happens when this menu is cancelled.
-
down(
) → void - Move down in this menu.
-
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 SDL events.
override
-
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.
override
-
onPush(
{double? fadeLength}) → void -
Show the current item in this menu when it is pushed.
override
-
onReveal(
Level old) → void -
What should happen when this level is revealed by another level being
popped from on top of it.
override
-
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 -
showCurrentItem(
) → void - Show the current item.
-
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
-
up(
) → void - Move up in this menu.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited