DefaultViewport class
This is the default viewport if you want no transformation. The raw canvasSize is just propagated to the effective size and no translation is applied. This basically no-ops the viewport.
Constructors
Properties
- canvasSize ↔ Vector2?
-
This returns the real widget size (well actually the logical Flutter
size of your widget). This is the raw canvas size as it would be without
any viewport.
getter/setter pairinherited
- effectiveSize → Vector2
-
This returns the effective size, after viewport transformation.
This is not the game widget size but for all intents and purposes,
inside your game, this size should be used as the real one.
no setteroverride
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
apply(
Canvas c) → void -
Applies to the Canvas all necessary transformations to apply this
viewport.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
projectVector(
Vector2 vector) → Vector2 -
Converts a vector in the world space to the screen space.
override
-
render(
Canvas c, void renderGame(Canvas)) → void -
This transforms the canvas so that the coordinate system is viewport-
-aware. All your rendering logic should be put inside the lambda.
inherited
-
resize(
Vector2 newCanvasSize) → void -
This configures the viewport with a new raw canvas size.
It should immediately affect effectiveSize and canvasSize.
This must be called by the engine at startup and also whenever the
size changes.
override
-
scaleVector(
Vector2 vector) → Vector2 -
Converts a vector representing a delta in the world space to the screen
space.
override
-
toString(
) → String -
A string representation of this object.
inherited
-
unprojectVector(
Vector2 vector) → Vector2 -
Converts a vector in the screen space to the world space.
override
-
unscaleVector(
Vector2 vector) → Vector2 -
Converts a vector representing a delta in the screen space to the world
space.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited