Skip to content

Commit

Permalink
Added pitch functions to base Camera class
Browse files Browse the repository at this point in the history
  • Loading branch information
jameskellie committed Jul 2, 2024
1 parent ff7a728 commit 644c400
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
5 changes: 5 additions & 0 deletions source/MonoGame.Extended/Camera.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ public abstract class Camera<T> where T : struct
public abstract float Zoom { get; set; }
public abstract float MinimumZoom { get; set; }
public abstract float MaximumZoom { get; set; }
public abstract float Pitch { get; set; }
public abstract float MinimumPitch { get; set; }
public abstract float MaximumPitch { get; set; }
public abstract RectangleF BoundingRectangle { get; }
public abstract T Origin { get; set; }
public abstract T Center { get; }
Expand All @@ -17,6 +20,8 @@ public abstract class Camera<T> where T : struct
public abstract void Rotate(float deltaRadians);
public abstract void ZoomIn(float deltaZoom);
public abstract void ZoomOut(float deltaZoom);
public abstract void PitchUp(float deltaZoom);
public abstract void PitchDown(float deltaZoom);
public abstract void LookAt(T position);

public abstract T WorldToScreen(T worldPosition);
Expand Down
10 changes: 5 additions & 5 deletions source/MonoGame.Extended/OrthographicCamera.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public override float MaximumZoom
}
}

public float Pitch
public override float Pitch
{
get => _pitch;
set
Expand All @@ -90,7 +90,7 @@ public float Pitch
}
}

public float MinimumPitch
public override float MinimumPitch
{
get => _minimumPitch;
set
Expand All @@ -105,7 +105,7 @@ public float MinimumPitch
}
}

public float MaximumPitch
public override float MaximumPitch
{
get => _maximumPitch;
set
Expand Down Expand Up @@ -162,12 +162,12 @@ private void ClampZoom(float value)
Zoom = value > MaximumZoom ? MaximumZoom : value;
}

public void PitchUp(float deltaPitch)
public override void PitchUp(float deltaPitch)
{
ClampPitch(Pitch + deltaPitch);
}

public void PitchDown(float deltaPitch)
public override void PitchDown(float deltaPitch)
{
ClampPitch(Pitch - deltaPitch);
}
Expand Down

0 comments on commit 644c400

Please sign in to comment.