Class Camera2D
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
gameGame
Properties
Position
public Vector2 Position { get; set; }
Property Value
Rotation
public float Rotation { get; set; }
Property Value
ViewportSize
public Vector2 ViewportSize { get; }
Property Value
Zoom
public float Zoom { get; set; }
Property Value
Methods
Pan(Vector2)
Moves the camera by a world-space amount.
public void Pan(Vector2 worldDelta)
Parameters
worldDeltaVector2
ScreenToWorld(Vector2)
public Vector2 ScreenToWorld(Vector2 screenPosition)
Parameters
screenPositionVector2
Returns
WorldToScreen(Vector2)
public Vector2 WorldToScreen(Vector2 worldPosition)
Parameters
worldPositionVector2
Returns
ZoomAt(float, Vector2)
Changes zoom while keeping the world point beneath a screen position fixed.
public void ZoomAt(float factor, Vector2 screenPosition)