Class Camera2D
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
positionPixelsInt2The camera position in world pixels.
viewportSizePixelsInt2The viewport size in pixels.
Properties
PositionPixels
Gets or sets the camera position in world pixels.
public Int2 PositionPixels { get; set; }
Property Value
ViewportSizePixels
Gets or sets the viewport size in pixels.
public Int2 ViewportSizePixels { get; set; }
Property Value
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
screenPositionPixelsInt2The 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
worldPositionPixelsInt2The world-space coordinate.
Returns
- Int2
The corresponding screen-space coordinate.