default : Camera2D
Identity camera: no offset or rotation, with unit zoom.
:= []
Camera module - pure 2D camera settings for world-space drawing.
A camera is a value, not a host-owned resource. Build the camera you want
for the current frame and pass it to Draw.with_camera!.
default : Camera2D
Identity camera: no offset or rotation, with unit zoom.
new : Settings -> Try(Camera2D, [ZeroZoom, NonFiniteZoom, NonFiniteTarget, NonFiniteOffset, NonFiniteRotation, ..])
Construct a camera from explicit settings, rejecting every non-finite transform field and zero zoom.
Place target at the center of a screen with unit zoom.
follow : Vec2, { screen : Vec2, zoom : F32 } -> Try(Camera2D, [ZeroZoom, NonFiniteZoom, NonFiniteTarget, NonFiniteOffset, ..])
A common player-follow camera with a validated configurable zoom.
Target, screen offset, clockwise rotation in degrees, and zoom factor.
Camera.Camera2D :: # (opaque)
Immutable camera value accepted by drawing and coordinate transforms. Its representation is opaque so non-finite transform fields or a non-invertible zero zoom cannot bypass validation.
World-space point placed at the camera offset.
Logical screen-space offset of the target.
Clockwise camera rotation in degrees.
Non-zero camera zoom factor. Negative values intentionally mirror axes.
with_target : Camera2D, Vec2 -> Try(Camera2D, [NonFiniteTarget, ..])
Return a copy focused on a finite world-space target.
with_offset : Camera2D, Vec2 -> Try(Camera2D, [NonFiniteOffset, ..])
Return a copy with a finite logical screen-space offset.
with_rotation : Camera2D, F32 -> Try(Camera2D, [NonFiniteRotation, ..])
Return a copy with a finite clockwise rotation in degrees.
Return a copy with a validated finite, non-zero zoom factor.
clamp_zoom : Camera2D, { min : F32, max : F32 } -> Try(Camera2D, [ZeroZoom, NonFiniteZoom, ..])
Clamp zoom to inclusive limits, reporting a range that produces zero.
world_to_screen : Camera2D, Vec2 -> Vec2
Convert a world-space point to logical screen coordinates.
Rotation uses degrees, matching raylib and Draw.with_camera!.
screen_to_world : Camera2D, Vec2 -> Vec2
Convert logical screen coordinates back to world space. Every Camera2D is invertible because construction rejects zero zoom.
World-space axis-aligned bounds visible through this camera. This handles non-centered offsets, rotation, and mirrored (negative) zoom.