Box2DGame class

Inheritance

Constructors

Box2DGame(Box2DComponent box)

Properties

box Box2DComponent
final
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
pauseEngineFn VoidCallback
read / write, inherited
resumeEngineFn VoidCallback
read / write, inherited
runOnCreation bool
Flag to tell the game loop if it should start running upon creation
read / write, 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. [...]
override
addContactCallback(ContactCallback callback) → void
addLater(Component c) → void
Registers a component to be added on the components on the next tick. [...]
override
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
clearContactCallbacks() → void
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 FPS based on the frame times from onTimingsCallback.
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
markToRemove(Component c) → void
Marks a component to be removed from the components list on the next game loop cycle
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
onAttach() → void
@mustCallSuper, inherited
onDetach() → void
@mustCallSuper, inherited
onTimingsCallback(List<FrameTiming> timings) → void
Use for caluclating the FPS.
inherited
pauseEngine() → void
Pauses the engine game loop execution
inherited
preAdd(Component c) → void
This method is called for every component added, both via add and addLater methods. [...]
@mustCallSuper, inherited
recordDt(double dt) → void
Used for debugging
@Deprecated('Gets called for backward compatibility, will be removed in v1'), inherited
recordFps() bool
Returns whether this Game is should record fps or not. [...]
inherited
removeContactCallback(ContactCallback callback) → void
render(Canvas canvas) → void
This implementation of render basically calls renderComponent for every component, making sure the canvas is reset for each one. [...]
@mustCallSuper, 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
resumeEngine() → void
Resumes the engine game loop execution
inherited
toString() String
A string representation of this object. [...]
inherited
update(double t) → void
This implementation of update updates every component in the list. [...]
override

Operators

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