Camera

Represents a 2D camera used for rendering.

Constructor

Represents a 2D camera used for rendering.

Properties


NameDescriptionType
posGet or set the camera's position.Vec2

Methods


Set

set() None

Set this camera as the active one for rendering.

Only one camera can be active at a time.

World To Screen

world_to_screen(world_pos: Vec2) Vec2

Convert a world position to a screen position using this camera's translation.

Args

  • world_pos : The world position to convert.

Returns

Vec2 : The resulting screen position.

Screen To World

screen_to_world(screen_pos: Vec2) Vec2

Convert a screen position to a world position using this camera's translation.

Args

  • screen_pos : The screen position to convert.

Returns

Vec2 : The resulting world position.