Viewport class

Inheritance

Constructors

Viewport(Vector2 size, double scale)

Properties

center Vector2
center of the viewport.
read / write, inherited
extents Vector2
This is the half-width and half-height. This should be the actual half-width and half-height, not anything transformed or scaled.
read / write, inherited
hashCode int
The hash code for this object. [...]
read-only, inherited
height double
read-only
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
scale double
Returns the scaling factor used in converting from world sizes to rendering sizes.
read / write, override
size Vector2
read / write
translation Vector2
The current translation is the difference in canvas units between the actual center of the canvas and the currently specified center. For example, if the actual canvas center is (5, 5) but the current center is (6, 6), the translation is (1, 1).
read / write, inherited
width double
read-only
yFlip bool
if we flip the y axis when transforming.
read / write, inherited

Methods

cameraFollow(BodyComponent<Forge2DGame> component, {double horizontal, double vertical}) → void
Follows the specified body component using a sliding focus window defined as a percentage of the total viewport. [...]
getCenterHorizontalScreenPercentage({double screens = 1.0}) double
Computes the scroll percentage of total screen width of the current viewport center position. [...]
getScreenToWorld(Vector2 argScreen) Vector2
Takes the screen coordinates and return the corresponding world coordinates
inherited
getWorldToScreen(Vector2 argWorld) Vector2
Takes the world coordinates and return the corresponding screen coordinates
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
resize(Vector2 size) → void
Resizes the current viewport.
setCamera(double x, double y, double s) → void
Sets the transform's center to the given x and y coordinates, and using the given scale.
inherited
toString() String
A string representation of this object. [...]
inherited
worldAlignBottom(double height) double
worldWidth(double percent) double
Computes the number of horizontal world meters of this viewport considering a percentage of its width. [...]

Operators

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