From b594c271ac1cf4ad53fe03d4f200f703e54005a5 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Tue, 9 Mar 2021 02:29:06 +0100 Subject: [PATCH] expose the viewport of a camera --- MLEM/Cameras/Camera.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/MLEM/Cameras/Camera.cs b/MLEM/Cameras/Camera.cs index 3800e56..f84f292 100644 --- a/MLEM/Cameras/Camera.cs +++ b/MLEM/Cameras/Camera.cs @@ -23,7 +23,6 @@ namespace MLEM.Cameras { get => this.scale; set => this.scale = MathHelper.Clamp(value, this.MinScale, this.MaxScale); } - private float scale = 1; /// /// The minimum that the camera can have /// @@ -79,11 +78,15 @@ namespace MLEM.Cameras { get => this.Position + this.ScaledViewport / 2; set => this.Position = value - this.ScaledViewport / 2; } - private Rectangle Viewport => this.graphicsDevice.Viewport.Bounds; - private Vector2 ScaledViewport => new Vector2(this.Viewport.Width, this.Viewport.Height) / this.ActualScale; + /// + /// The viewport of this camera, based on the game's and this camera's + /// + public Vector2 ScaledViewport => new Vector2(this.Viewport.Width, this.Viewport.Height) / this.ActualScale; + private Rectangle Viewport => this.graphicsDevice.Viewport.Bounds; private readonly bool roundPosition; private readonly GraphicsDevice graphicsDevice; + private float scale = 1; /// /// Creates a new camera.