Camera2D

class Camera2D(raw: ERROR CLASS: Symbol not found for raylib.internal.Camera2D)

Represents a 2D Camera in raylib.

Constructors

Link copied to clipboard
constructor(raw: ERROR CLASS: Symbol not found for raylib.internal.Camera2D)
constructor(offset: ERROR CLASS: Symbol not found for Pair<kotlin/Float, kotlin/Float> = 0F to 0F, target: ERROR CLASS: Symbol not found for Pair<kotlin/Float, kotlin/Float> = 0F to 0F, rotation: Float = 0.0f, zoom: Float = 1.0f)

Creates a new 2D Camera.

constructor(ox: Float = 0.0f, oy: Float = 0.0f, targetX: Float = 0.0f, targetY: Float = 0.0f, rotation: Float = 0.0f, zoom: Float = 1.0f)

Creates a new 2D Camera.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val bottomLeft: ERROR CLASS: Symbol not found for Pair<kotlin/Float, kotlin/Float>

The bottom-left corner of the camera as world coordinates.

Link copied to clipboard
val bottomRight: ERROR CLASS: Symbol not found for Pair<kotlin/Float, kotlin/Float>

The bottom-right corner of the camera as world coordinates.

Link copied to clipboard

The camera's transformation matrix.

Link copied to clipboard
var offset: ERROR CLASS: Symbol not found for Pair<kotlin/Float, kotlin/Float>

Screen position where the target appears.

Link copied to clipboard

The X coordinate of the position for the target.

Link copied to clipboard

The Y coordinate of the position for the target.

Link copied to clipboard

Camera rotation, in degrees.

Link copied to clipboard
var target: ERROR CLASS: Symbol not found for Pair<kotlin/Float, kotlin/Float>

The camera's target and the origin of the rotation and zoom

Link copied to clipboard

The X coordinate of the camera's target.

Link copied to clipboard

The Y coordinate of the camera's target.

Link copied to clipboard
val topLeft: ERROR CLASS: Symbol not found for Pair<kotlin/Float, kotlin/Float>

The top-left corner of the camera as world coordinates.

Link copied to clipboard
val topRight: ERROR CLASS: Symbol not found for Pair<kotlin/Float, kotlin/Float>

The top-left corner of the camera as world coordinates.

Link copied to clipboard
var zoom: Float

Camera zoom scale

Functions

Link copied to clipboard
fun followCenter(sprite: Sprite2D)

Updates the camera to follow the sprite's center position directly.

Link copied to clipboard
fun followPlayerBoundsPush(sprite: Sprite2D, bboxX: Float = 0.2f, bboxY: Float = 0.2f)

Updates the camera so that it only moves when the sprite approaches screen edges. Creates a "dead zone" in the center where camera doesn't move. Higher bbox values means the camera moves more often.

Link copied to clipboard
fun screenToWorld(position: ERROR CLASS: Symbol not found for Pair<kotlin/Float, kotlin/Float>): ERROR CLASS: Symbol not found for Pair<kotlin/Float, kotlin/Float>
fun screenToWorld(x: Float, y: Float): ERROR CLASS: Symbol not found for Pair<kotlin/Float, kotlin/Float>
fun screenToWorld(x: Int, y: Int): ERROR CLASS: Symbol not found for Pair<kotlin/Float, kotlin/Float>

Converts screen coordinates to world coordinates based on the camera's transformation.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
fun unload()

Frees the native memory used by the Camera2D.

Link copied to clipboard
fun worldToScreen(position: ERROR CLASS: Symbol not found for Pair<kotlin/Float, kotlin/Float>): ERROR CLASS: Symbol not found for Pair<kotlin/Float, kotlin/Float>
fun worldToScreen(x: Float, y: Float): ERROR CLASS: Symbol not found for Pair<kotlin/Float, kotlin/Float>
fun worldToScreen(x: Int, y: Int): ERROR CLASS: Symbol not found for Pair<kotlin/Float, kotlin/Float>

Converts world coordinates to screen coordinates based on the camera's transformation.