ScaleDetector mixin
- Superclass constraints
- Available extensions
Properties
- assets ↔ AssetsCache
-
The cache of all (non-image) assets loaded into the game. This defaults to
the global Flame.assets cache, but you can replace this with another
instance if needed.
getter/setter pairinherited
- buildContext → BuildContext?
-
Currently attached build context. Can be null if not attached.
no setterinherited
- canvasSize → Vector2
-
no setterinherited
-
gameStateListeners
→ List<
VoidCallback> -
finalinherited
- gestureDetectors → GestureDetectorBuilder
-
Used internally by various mixins that need to use gesture detection
functionality in Flutter.
latefinalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasLayout → bool
-
Indicates if this game instance is connected to a GameWidget that is live
in the flutter widget tree.
Once this is true, the game is ready to have its size used or in the case
of a FlameGame, to receive components.
no setterinherited
- images ↔ Images
-
The cache of all images loaded into the game. This defaults to the global
Flame.images cache, but you can replace it with a new cache instance if
needed.
getter/setter pairinherited
- isAttached → bool
-
Whether the game widget was attached to the Flutter tree.
no setterinherited
- mouseCursor ↔ MouseCursor
-
Used to change the mouse cursor of the GameWidget running this game.
Setting the value to null will make the GameWidget defer the choice
of the cursor to the closest region available on the tree.
getter/setter pairinherited
- mouseDetector ↔ void Function(PointerHoverEvent event)?
-
Set by the PointerMoveDispatcher to receive mouse events from the
game widget.
getter/setter pairinherited
- overlays → OverlayManager
-
A property that stores an
OverlayManager
latefinalinherited - paused ↔ bool
-
Returns is the engine if currently paused or running
getter/setter pairinherited
- renderBox → GameRenderBox
-
Just a reference back to the render box that is kept up to date by the
engine.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- size → Vector2
-
Current game viewport size, updated every resize via the onGameResize
method hook.
no setterinherited
Methods
-
addGameStateListener(
VoidCallback callback) → void -
inherited
-
assertHasLayout(
) → void -
inherited
-
attach(
PipelineOwner owner, GameRenderBox gameRenderBox) → void -
Marks game as attached to any Flutter widget tree.
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
-
convertGlobalToLocalCoordinate(
Vector2 point) → Vector2 -
Converts a global coordinate (i.e. w.r.t. the app itself) to a local
coordinate (i.e. w.r.t. he game widget).
If the widget occupies the whole app ("full screen" games), or is not
attached to Flutter, this operation is the identity.
inherited
-
convertLocalToGlobalCoordinate(
Vector2 point) → Vector2 -
Converts a local coordinate (i.e. w.r.t. the game widget) to a global
coordinate (i.e. w.r.t. the app itself).
If the widget occupies the whole app ("full screen" games), or is not
attached to Flutter, this operation is the identity.
inherited
-
detach(
) → void -
Marks game as no longer attached to any Flutter widget tree.
inherited
-
finalizeRemoval(
) → void -
inherited
-
handleScaleEnd(
ScaleEndDetails details) → void -
handleScaleStart(
ScaleStartDetails details) → void -
handleScaleUpdate(
ScaleUpdateDetails details) → void -
lifecycleStateChange(
AppLifecycleState state) → void -
This is the lifecycle state change hook; every time the game is resumed,
paused or suspended, this is called.
inherited
-
load(
) → FutureOr< void> -
inherited
-
loadParallax(
List< ParallaxData> dataList, {Vector2? size, Vector2? baseVelocity, Vector2? velocityMultiplierDelta, ImageRepeat repeat = ImageRepeat.repeatX, Alignment alignment = Alignment.bottomLeft, LayerFill fill = LayerFill.height, FilterQuality? filterQuality}) → Future<Parallax> -
Available on Game, provided by the ParallaxExtension extension
-
loadParallaxAnimation(
String path, SpriteAnimationData animationData, {ImageRepeat repeat = ImageRepeat.repeatX, Alignment alignment = Alignment.bottomLeft, LayerFill fill = LayerFill.height, FilterQuality? filterQuality}) → Future< ParallaxAnimation> -
Available on Game, provided by the ParallaxExtension extension
-
loadParallaxImage(
String path, {ImageRepeat repeat = ImageRepeat.repeatX, Alignment alignment = Alignment.bottomLeft, LayerFill fill = LayerFill.height, FilterQuality? filterQuality}) → Future< ParallaxImage> -
Available on Game, provided by the ParallaxExtension extension
-
loadParallaxLayer(
ParallaxData data, {ImageRepeat repeat = ImageRepeat.repeatX, Alignment alignment = Alignment.bottomLeft, LayerFill fill = LayerFill.height, Vector2? velocityMultiplier, FilterQuality? filterQuality}) → Future< ParallaxLayer> -
Available on Game, provided by the ParallaxExtension extension
-
loadSprite(
String path, {Vector2? srcSize, Vector2? srcPosition}) → Future< Sprite> -
Utility method to load and cache the image for a sprite based on its
options.
inherited
-
loadSpriteAnimation(
String path, SpriteAnimationData data) → Future< SpriteAnimation> -
Utility method to load and cache the image for a sprite animation based on
its options.
inherited
-
loadSpriteBatch(
String path, {Color? defaultColor, BlendMode? defaultBlendMode, RSTransform? defaultTransform, Images? imageCache, bool useAtlas = true}) → Future< SpriteBatch> -
Available on Game, provided by the SpriteBatchExtension extension
Utility method to load and cache the image for a SpriteBatch based on its options. -
mount(
) → void -
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onAttach(
) → void -
Called when the game has been attached. This can be overridden
to add logic that requires the game to already be attached
to the widget tree.
inherited
-
onDetach(
) → void -
Called after the game has left the widget tree.
This can be overridden to add logic that requires the game
not be on the flutter widget tree anymore.
inherited
-
onDispose(
) → void -
Called when the GameWidget is disposed by Flutter.
inherited
-
onGameResize(
Vector2 size) → void -
This is the resize hook; every time the game widget is resized, this hook
is called.
inherited
-
onLoad(
) → FutureOr< void> -
Method to perform late initialization of the Game class.
inherited
-
onMount(
) → void -
inherited
-
onRemove(
) → void -
Called when the game is about to be removed from the Flutter widget tree,
but before it is actually removed. See the docs for an example on how to
do cleanups to avoid memory leaks.
inherited
-
onScaleEnd(
ScaleEndInfo info) → void -
onScaleStart(
ScaleStartInfo info) → void -
onScaleUpdate(
ScaleUpdateInfo info) → void -
pauseEngine(
) → void -
Pauses the engine game loop execution.
inherited
-
refreshWidget(
{bool isInternalRefresh = true}) → void -
When a Game is attached to a
GameWidget
, this method will force that widget to be rebuilt. This can be used when updating any property which is implemented within the Flutter tree.inherited -
removeGameStateListener(
VoidCallback callback) → void -
inherited
-
render(
Canvas canvas) → void -
This should render the game.
inherited
-
resumeEngine(
) → void -
Resumes the engine game loop execution.
inherited
-
stepEngine(
{double stepTime = 1 / 60}) → void -
Steps the engine game loop by one frame. Works only if the engine is in
paused state. By default step time is assumed to be 1/60th of a second.
inherited
-
toBeLoaded(
) → FutureOr< void> -
To be used for tests that needs to evaluate the game after it has been
loaded by the game widget.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
update(
double dt) → void -
This should update the state of the game.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited