SimpleGame class

This is a helper implementation of a BaseGame designed to allow to easily create a game with a single component.

This is useful to add sprites, animations and other Flame components "directly" to your non-game Flutter widget tree, when combined with EmbeddedGameWidget.

Inheritance

Constructors

SimpleGame(Component c)

Properties

builder WidgetBuilder
final, inherited
camera Position
Camera position; every non-HUD component is translated so that the camera position is the top-left corner of the screen.
read / write, inherited
components OrderedSet<Component>
The list of components to be updated and rendered by the base game.
read / write, inherited
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
size Size
Current screen size, updated every resize via the resize method hook
read / write, 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, inherited

Methods

add(Component c) → void
Adds a new component to the components list. [...]
inherited
addLater(Component c) → void
Registers a component to be added on the components on the next tick. [...]
inherited
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.
inherited
currentTime() double
Returns the current time in seconds with microseconds precision. [...]
inherited
debugMode() bool
Returns whether this Game is in debug mode or not. [...]
inherited
fps([int average = 1]) double
Returns the average FPS for the last average measures. [...]
inherited
lifecycleStateChange(AppLifecycleState state) → void
This is the lifecycle state change hook; every time the game is resumed, paused or suspended, this is called. [...]
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
onAttach() → void
inherited
onDetach() → void
inherited
onTap() → void
inherited
onTapCancel() → void
inherited
onTapDown(TapDownDetails details) → void
inherited
onTapUp(TapUpDetails details) → void
inherited
preAdd(Component c) → void
This method is called for every component added, both via add and addLater methods. [...]
@mustCallSuper, inherited
render(Canvas canvas) → void
This implementation of render basically calls renderComponent for every component, making sure the canvas is reset for each one. [...]
inherited
renderComponent(Canvas canvas, Component c) → void
This renders a single component obeying BaseGame rules. [...]
inherited
resize(Size size) → void
This implementation of resize passes the resize call along to every component in the list, enabling each one to make their decisions as how to handle the resize. [...]
@mustCallSuper, inherited
toString() String
A string representation of this object. [...]
inherited
update(double t) → void
This implementation of update updates every component in the list. [...]
inherited

Operators

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