feat: EngineConverter.ApplyDisplayScale
This commit is contained in:
		| @@ -10,9 +10,7 @@ namespace Pong.Behaviours; | ||||
|  | ||||
| public class ShapeAABBBehaviour : BehaviourOverride, IDisplayableShape | ||||
| { | ||||
|     private Shape transformedShape = new([]); | ||||
|     private IShapeCollider2D? shapeCollider = null; | ||||
|     private readonly static Vector2D screenScale = Vector2D.Down + Vector2D.Right; | ||||
|  | ||||
|     public ShapeAABBBehaviour() { } | ||||
|     public ShapeAABBBehaviour(float Thickness) { this.Thickness = Thickness; } | ||||
| @@ -36,6 +34,6 @@ public class ShapeAABBBehaviour : BehaviourOverride, IDisplayableShape | ||||
|  | ||||
|         shapeBatch.BorderCircle(aabb.Center.ToDisplayVector2(), 7.5f, Color.Beige); | ||||
|  | ||||
|         shapeBatch.DrawRectangle(aabb.Center.Scale(screenScale).Subtract(aabb.SizeHalf).ToVector2(), aabb.Size.ToVector2(), Color.Transparent, Color.Blue); | ||||
|         shapeBatch.DrawRectangle(aabb.Center.ApplyDisplayScale().Subtract(aabb.SizeHalf).ToVector2(), aabb.Size.ToVector2(), Color.Transparent, Color.Blue); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -16,4 +16,6 @@ public static class EngineConverter | ||||
|     public static Vector2 ToVector2(this Vector2D vector) => new(vector.X, vector.Y); | ||||
|     [MethodImpl(MethodImplOptions.AggressiveInlining)] | ||||
|     public static Vector2 ToDisplayVector2(this Vector2D vector) => vector.Scale(screenScale).ToVector2(); | ||||
|     [MethodImpl(MethodImplOptions.AggressiveInlining)] | ||||
|     public static Vector2D ApplyDisplayScale(this Vector2D vector) => vector.Scale(screenScale); | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user