Camera2D

Namespace: Murder.Core.Graphics
Assembly: Murder.dll

public class Camera2D

Creates a camera 2D world view for our game.

⭐ Constructors

public Camera2D(int width, int height)

Parameters
width int
height int

⭐ Properties

Aspect

public float Aspect { get; }

Returns
float

Bounds

public Rectangle Bounds { get; private set; }

Returns
Rectangle

HalfWidth

public int HalfWidth { get; }

Returns
int

Height

public int Height { get; private set; }

Returns
int

Position

public Vector2 Position { get; public set; }

Returns
Vector2

SafeBounds

public Rectangle SafeBounds { get; private set; }

Returns
Rectangle

ShakeIntensity

public float ShakeIntensity;

Returns
float

ShakeTime

public float ShakeTime;

Returns
float

Size

public Point Size { get; }

Returns
Point

Width

public int Width { get; private set; }

Returns
int

WorldViewProjection

public Matrix WorldViewProjection { get; }

Returns
Matrix

Zoom

public float Zoom { get; public set; }

Returns
float

⭐ Methods

GetCursorWorldPosition(Point, Point)

public Point GetCursorWorldPosition(Point screenOffset, Point viewportSize)

Get coordinates of the cursor in the world. Ideally you should use the EditorHook for this if you are in an editor System.

Parameters
screenOffset Point
viewportSize Point

Returns
Point

ConvertWorldToScreenPosition(Vector2, Point)

public Vector2 ConvertWorldToScreenPosition(Vector2 position, Point viewportSize)

Get coordinates of the cursor in the world.

Parameters
position Vector2
viewportSize Point

Returns
Vector2

ScreenToWorldPosition(Vector2)

public Vector2 ScreenToWorldPosition(Vector2 screenPosition)

Parameters
screenPosition Vector2

Returns
Vector2

WorldToScreenPosition(Vector2)

public Vector2 WorldToScreenPosition(Vector2 screenPosition)

Parameters
screenPosition Vector2

Returns
Vector2

ClearCache()

public void ClearCache()

Lock()

public void Lock()

Rotate(float)

public void Rotate(float degrees)

Parameters
degrees float

Shake(float, float)

public void Shake(float intensity, float time)

Parameters
intensity float
time float

Unlock()

public void Unlock()