Handles view operations of the game
- Inheritance
- Object
- DOMView
- GameView
Constructors
- GameView(GameMode _gameMode, LevelManager _levelManager)
-
GameView constructor with given
gameMode
andlevelManager
Properties
- isRunning → bool
-
If the game is currently running
read-only - onInput → Stream<Vector2>
-
Stream of movement vectors
read / write - onSelectLevel → Stream<int>
-
When a level has been chosen to play
read / write - hashCode → int
-
The hash code for this object.
read-only, inherited - runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
Operators
-
operator ==(
other) → bool -
The equality operator.
inherited
Methods
-
closeGameView(
bool failed) → Future -
Closes the game view and shows the menu where
failed
indicates whether the game was lost before -
createActor(
Actor actor) → dynamic -
Creates a new
actor
in the view based on the model. -
hintBig(
String text, Duration duration) → Future -
Shows a big hint label with
text
in the upper center of the screen for the givenduration
-
openGameView(
) → Future -
Creates a new game view and hides the menu.
-
removeActor(
Actor actor) → dynamic -
Removes the
actor
from the view. -
activate(
Element el) → void -
Activates
el
by adding the "active" class to itinherited -
clearCache(
) → dynamic -
Clears the Cache
inherited -
create(
Element host, String id) → Element -
Creates a new div with the given
id
on thehost
and returns theElement
inherited -
deactivate(
Element el) → void -
Deactivates
el
by removing the "active" class from itinherited -
get(
String id) → Element -
Gets an
Element
from the DOM by theid
or from the cache if availableinherited -
hide(
Element el) → void -
Hides
el
by adding the "hidden" class to itinherited -
move(
Element el, Vector2 position) → void -
inherited
-
nextFrame(
) → Future<num> -
Returns a
Future
that resolves before the next animation frame with the given runtimeinherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed.
inherited -
remove(
String id) → void -
Removes an Element from the DOM by the
id
inherited -
rotate(
Element el, Vector2 rotation) → void -
inherited
-
scale(
Element el, Vector2 scale) → void -
inherited
-
setDimensions(
Element el, Vector2 size) → void -
inherited
-
show(
Element el) → void -
Shows
el
by removing the "hidden" class from itinherited -
timeout(
Duration duration, { Function before, Function after }) → Future -
Returns a
Future
that resolves afterDuration
and optionally callsbefore
andafter
the Duration.inherited -
toString(
) → String -
Returns a string representation of this object.
inherited -
transform(
Element el, { Vector2 position, Vector2 rotation, Vector2 scale }) → void -
Updates the transform on
el
using optional Vectors. This function prevents seperate manual transform updates, that either update rotatiom, position or scale to override each other.inherited -
wait(
Duration duration) → Future -
Returns a
Future
that resolves afterduration
inherited