Header menu logo Mibo

Camera2D Module

Constructors and utilities for Camera2D.

Functions and values

Function or value Description

create position zoom viewportSize

Full Usage: create position zoom viewportSize

Parameters:
    position : Vector2 - World position the camera follows.
    zoom : float32 - Zoom factor (1.0 = default).
    viewportSize : Vector2 - Size of the viewport in pixels (used to compute origin).

Returns: Camera2D

Creates a Camera2D centered on the given position.

position : Vector2

World position the camera follows.

zoom : float32

Zoom factor (1.0 = default).

viewportSize : Vector2

Size of the viewport in pixels (used to compute origin).

Returns: Camera2D

toMatrix c

Full Usage: toMatrix c

Parameters:
Returns: Matrix

Computes the SpriteBatch transform matrix for this camera.

The matrix applies: translate by -position, rotate, scale by zoom, then translate by origin. Pass this to SpriteBatch.Begin(transformMatrix=...).

c : Camera2D
Returns: Matrix

Type something to start searching.