refactor: Math.Pow to Math.Sqr

This commit is contained in:
Syntriax 2024-01-30 12:50:21 +03:00
parent 46f589d3aa
commit 5ef3d491c3
1 changed files with 2 additions and 2 deletions

View File

@ -50,8 +50,8 @@ public class CameraController : BehaviourOverride
Game1.graphics.IsFullScreen = true; Game1.graphics.IsFullScreen = true;
Game1.graphics.ApplyChanges(); Game1.graphics.ApplyChanges();
float previousScreenSize = Math.Sqrt(Math.Pow(cameraBehaviour.Viewport.Width, 2f) + Math.Pow(cameraBehaviour.Viewport.Height, 2f)); float previousScreenSize = Math.Sqrt(Math.Sqr(cameraBehaviour.Viewport.Width) + Math.Sqr(cameraBehaviour.Viewport.Height));
float currentScreenSize = Math.Sqrt(Math.Pow(Game1.graphics.GraphicsDevice.Viewport.Width, 2f) + Math.Pow(Game1.graphics.GraphicsDevice.Viewport.Height, 2f)); float currentScreenSize = Math.Sqrt(Math.Sqr(Game1.graphics.GraphicsDevice.Viewport.Width) + Math.Sqr(Game1.graphics.GraphicsDevice.Viewport.Height));
defaultZoomLevel /= previousScreenSize / currentScreenSize; defaultZoomLevel /= previousScreenSize / currentScreenSize;
cameraBehaviour.Zoom /= previousScreenSize / currentScreenSize; cameraBehaviour.Zoom /= previousScreenSize / currentScreenSize;
cameraBehaviour.Viewport = Game1.graphics.GraphicsDevice.Viewport; cameraBehaviour.Viewport = Game1.graphics.GraphicsDevice.Viewport;