mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-26 22:48:34 +01:00
expose the viewport of a camera
This commit is contained in:
parent
0b39928334
commit
b594c271ac
1 changed files with 6 additions and 3 deletions
|
@ -23,7 +23,6 @@ namespace MLEM.Cameras {
|
||||||
get => this.scale;
|
get => this.scale;
|
||||||
set => this.scale = MathHelper.Clamp(value, this.MinScale, this.MaxScale);
|
set => this.scale = MathHelper.Clamp(value, this.MinScale, this.MaxScale);
|
||||||
}
|
}
|
||||||
private float scale = 1;
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The minimum <see cref="Scale"/> that the camera can have
|
/// The minimum <see cref="Scale"/> that the camera can have
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -79,11 +78,15 @@ namespace MLEM.Cameras {
|
||||||
get => this.Position + this.ScaledViewport / 2;
|
get => this.Position + this.ScaledViewport / 2;
|
||||||
set => this.Position = value - this.ScaledViewport / 2;
|
set => this.Position = value - this.ScaledViewport / 2;
|
||||||
}
|
}
|
||||||
private Rectangle Viewport => this.graphicsDevice.Viewport.Bounds;
|
/// <summary>
|
||||||
private Vector2 ScaledViewport => new Vector2(this.Viewport.Width, this.Viewport.Height) / this.ActualScale;
|
/// The viewport of this camera, based on the game's <see cref="GraphicsDevice.Viewport"/> and this camera's <see cref="ActualScale"/>
|
||||||
|
/// </summary>
|
||||||
|
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 bool roundPosition;
|
||||||
private readonly GraphicsDevice graphicsDevice;
|
private readonly GraphicsDevice graphicsDevice;
|
||||||
|
private float scale = 1;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a new camera.
|
/// Creates a new camera.
|
||||||
|
|
Loading…
Reference in a new issue