Table of Contents

Class Camera2D

Namespace
TileWorld.Engine.Render
Assembly
TileWorld.Engine.dll

Represents a simple pixel-space camera used to view the tile world.

public sealed class Camera2D
Inheritance
Camera2D
Inherited Members

Constructors

Camera2D()

Creates a camera at the origin with an empty viewport.

public Camera2D()

Camera2D(Int2, Int2)

Creates a camera with an explicit world position and viewport.

public Camera2D(Int2 positionPixels, Int2 viewportSizePixels)

Parameters

positionPixels Int2

The camera position in world pixels.

viewportSizePixels Int2

The viewport size in pixels.

Properties

PositionPixels

Gets or sets the camera position in world pixels.

public Int2 PositionPixels { get; set; }

Property Value

Int2

ViewportSizePixels

Gets or sets the viewport size in pixels.

public Int2 ViewportSizePixels { get; set; }

Property Value

Int2

Methods

GetWorldViewBounds()

Gets the current world-space view bounds covered by the camera.

public RectI GetWorldViewBounds()

Returns

RectI

The camera view bounds in world pixels.

ScreenToWorldPixels(Int2)

Converts a screen-space pixel coordinate into world-space pixels.

public Int2 ScreenToWorldPixels(Int2 screenPositionPixels)

Parameters

screenPositionPixels Int2

The screen-space coordinate.

Returns

Int2

The corresponding world-space coordinate.

WorldToScreenPixels(Int2)

Converts a world-space pixel coordinate into screen-space pixels.

public Int2 WorldToScreenPixels(Int2 worldPositionPixels)

Parameters

worldPositionPixels Int2

The world-space coordinate.

Returns

Int2

The corresponding screen-space coordinate.