Camera2D Class
A 2D camera for viewing and navigating the game world.
public sealed class Camera2D : Brine2D.Rendering.ICamera, Brine2D.Rendering.IShakableCamera, Brine2D.Rendering.ITrackableCamera, System.IDisposable
Inheritance System.Object → Camera2D
Implements ICamera, IShakableCamera, ITrackableCamera, System.IDisposable
| Constructors | |
|---|---|
| Camera2D(int, int, Nullable<int>) | Creates a new camera with an optional deterministic seed for shake randomness. |
| Properties | |
|---|---|
| ShakeSpace | Determines how shake offset is applied. World (default) applies the offset before zoom/rotation, so shake scales with zoom. Screen applies the offset after zoom/rotation, so shake feels consistent regardless of zoom level. |
| ViewportCenter | Gets the center of the viewport in screen coordinates. |
| Methods | |
|---|---|
| CancelShake() | Cancels any ongoing camera shake. |
| CenterOn(Vector2) | Immediately centers the camera on a target position. Bypasses the Brine2D.Rendering.Camera2D.Position setter for performance; dirty flags are set manually. |
| GetVisibleBounds() | Gets the visible world bounds. Intentionally excludes shake offset so that culling remains stable during camera shake. |
| Move(Vector2) | Moves the camera by the specified offset. Bypasses the Brine2D.Rendering.Camera2D.Position setter for performance; dirty flags are set manually. |