Table of Contents

Class Camera2D

Namespace
Axolotl2D.Rendering
Assembly
Axolotl2D.dll

A top-left-screen-space 2D camera for panning and zooming a world.

public sealed class Camera2D
Inheritance
Camera2D
Inherited Members

Constructors

Camera2D(Game)

public Camera2D(Game game)

Parameters

game Game

Properties

Position

public Vector2 Position { get; set; }

Property Value

Vector2

Rotation

public float Rotation { get; set; }

Property Value

float

ViewportSize

public Vector2 ViewportSize { get; }

Property Value

Vector2

Zoom

public float Zoom { get; set; }

Property Value

float

Methods

Pan(Vector2)

Moves the camera by a world-space amount.

public void Pan(Vector2 worldDelta)

Parameters

worldDelta Vector2

ScreenToWorld(Vector2)

public Vector2 ScreenToWorld(Vector2 screenPosition)

Parameters

screenPosition Vector2

Returns

Vector2

WorldToScreen(Vector2)

public Vector2 WorldToScreen(Vector2 worldPosition)

Parameters

worldPosition Vector2

Returns

Vector2

ZoomAt(float, Vector2)

Changes zoom while keeping the world point beneath a screen position fixed.

public void ZoomAt(float factor, Vector2 screenPosition)

Parameters

factor float
screenPosition Vector2