Game class

Represents a generic game.

Subclass this to implement the update and render methods. Flame will deal with calling these methods properly when the game's widget is rendered.

Implementers

Constructors

Game()

Properties

builder WidgetBuilder
final
hashCode int
The hash code for this object. [...]
read-only, inherited
pauseEngineFn VoidCallback
read / write
resumeEngineFn VoidCallback
read / write
runOnCreation bool
Flag to tell the game loop if it should start running upon creation
read / write
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
widget Widget
Returns the game widget. Put this in your structure to start rendering and updating the game. You can add it directly to the runApp method or inside your widget structure (if you use vanilla screens and widgets).
read-only

Methods

backgroundColor() Color
Returns the game background color. By default it will return a black color. It cannot be changed at runtime, because the game widget does not get rebuild when this value changes.
lifecycleStateChange(AppLifecycleState state) → void
This is the lifecycle state change hook; every time the game is resumed, paused or suspended, this is called. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
onAttach() → void
onDetach() → void
pauseEngine() → void
Pauses the engine game loop execution
recordDt(double dt) → void
Used for debugging
render(Canvas canvas) → void
Implement this method to render the current game state in the canvas.
resize(Size size) → void
This is the resize hook; every time the game widget is resized, this hook is called. [...]
resumeEngine() → void
Resumes the engine game loop execution
toString() String
Returns a string representation of this object.
inherited
update(double t) → void
Implement this method to update the game state, given that a time t has passed. [...]

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited