From 5ef3d491c3b0b14ede898fa9064340165515a46d Mon Sep 17 00:00:00 2001 From: Syntriax Date: Tue, 30 Jan 2024 12:50:21 +0300 Subject: [PATCH] refactor: Math.Pow to Math.Sqr --- Game/Behaviours/CameraController.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Game/Behaviours/CameraController.cs b/Game/Behaviours/CameraController.cs index 242f310..3d3a8d3 100644 --- a/Game/Behaviours/CameraController.cs +++ b/Game/Behaviours/CameraController.cs @@ -50,8 +50,8 @@ public class CameraController : BehaviourOverride Game1.graphics.IsFullScreen = true; Game1.graphics.ApplyChanges(); - float previousScreenSize = Math.Sqrt(Math.Pow(cameraBehaviour.Viewport.Width, 2f) + Math.Pow(cameraBehaviour.Viewport.Height, 2f)); - float currentScreenSize = Math.Sqrt(Math.Pow(Game1.graphics.GraphicsDevice.Viewport.Width, 2f) + Math.Pow(Game1.graphics.GraphicsDevice.Viewport.Height, 2f)); + float previousScreenSize = Math.Sqrt(Math.Sqr(cameraBehaviour.Viewport.Width) + Math.Sqr(cameraBehaviour.Viewport.Height)); + float currentScreenSize = Math.Sqrt(Math.Sqr(Game1.graphics.GraphicsDevice.Viewport.Width) + Math.Sqr(Game1.graphics.GraphicsDevice.Viewport.Height)); defaultZoomLevel /= previousScreenSize / currentScreenSize; cameraBehaviour.Zoom /= previousScreenSize / currentScreenSize; cameraBehaviour.Viewport = Game1.graphics.GraphicsDevice.Viewport;