chore: bumped dotnet version to 10
This commit is contained in:
@@ -11,26 +11,21 @@ public class MonoGameCamera2D : Behaviour, ICamera2D, IFirstFrameUpdate, ILastFr
|
||||
public Event<MonoGameCamera2D> OnViewportChanged { get; } = new();
|
||||
public Event<MonoGameCamera2D> OnZoomChanged { get; } = new();
|
||||
|
||||
private Matrix _matrixTransform = Matrix.Identity;
|
||||
|
||||
private Viewport _viewport = default;
|
||||
private float _zoom = 1f;
|
||||
|
||||
public GraphicsDeviceManager Graphics { get; private set; } = null!;
|
||||
public ITransform2D Transform { get; private set; } = null!;
|
||||
|
||||
public Matrix MatrixTransform
|
||||
{
|
||||
get => _matrixTransform;
|
||||
get;
|
||||
set
|
||||
{
|
||||
if (_matrixTransform == value)
|
||||
if (field == value)
|
||||
return;
|
||||
|
||||
_matrixTransform = value;
|
||||
field = value;
|
||||
OnMatrixTransformChanged.Invoke(this);
|
||||
}
|
||||
}
|
||||
} = Matrix.Identity;
|
||||
|
||||
public Vector2D Position
|
||||
{
|
||||
@@ -40,31 +35,31 @@ public class MonoGameCamera2D : Behaviour, ICamera2D, IFirstFrameUpdate, ILastFr
|
||||
|
||||
public Viewport Viewport
|
||||
{
|
||||
get => _viewport;
|
||||
get;
|
||||
set
|
||||
{
|
||||
if (_viewport.Equals(value))
|
||||
if (field.Equals(value))
|
||||
return;
|
||||
|
||||
_viewport = value;
|
||||
field = value;
|
||||
OnViewportChanged.Invoke(this);
|
||||
}
|
||||
}
|
||||
} = default;
|
||||
|
||||
public float Zoom
|
||||
{
|
||||
get => _zoom;
|
||||
get;
|
||||
set
|
||||
{
|
||||
float newValue = Math.Max(0.1f, value);
|
||||
|
||||
if (_zoom == newValue)
|
||||
if (field == newValue)
|
||||
return;
|
||||
|
||||
_zoom = newValue;
|
||||
field = newValue;
|
||||
OnZoomChanged.Invoke(this);
|
||||
}
|
||||
}
|
||||
} = 1f;
|
||||
|
||||
public float Rotation
|
||||
{
|
||||
@@ -99,6 +94,6 @@ public class MonoGameCamera2D : Behaviour, ICamera2D, IFirstFrameUpdate, ILastFr
|
||||
Matrix.CreateRotationZ(Rotation * Math.DegreeToRadian) *
|
||||
Matrix.CreateScale(Transform.Scale.X.Max(Transform.Scale.Y)) *
|
||||
Matrix.CreateScale(Zoom) *
|
||||
Matrix.CreateTranslation(new Vector3(_viewport.Width * .5f, _viewport.Height * .5f, 0f));
|
||||
Matrix.CreateTranslation(new Vector3(Viewport.Width * .5f, Viewport.Height * .5f, 0f));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user