diff --git a/src/SlatedGameToolkit.Framework/Graphics/Camera.cs b/src/SlatedGameToolkit.Framework/Graphics/Camera.cs index cbd9162..a08da2a 100644 --- a/src/SlatedGameToolkit.Framework/Graphics/Camera.cs +++ b/src/SlatedGameToolkit.Framework/Graphics/Camera.cs @@ -1,6 +1,7 @@ using System; using System.Numerics; using SlatedGameToolkit.Framework.Graphics.Render; +using SlatedGameToolkit.Framework.Logging; using SlatedGameToolkit.Framework.Utilities; namespace SlatedGameToolkit.Framework.Graphics @@ -176,6 +177,7 @@ namespace SlatedGameToolkit.Framework.Graphics this.Width = width; this.Height = height; this.CameraFront = -Vector3.UnitZ; + Logger.Log(string.Format("Camera initial dimensions: {0}x{1}, ratio of view: {2}", width, height, width / height), LogLevel.DEBUG); } } } \ No newline at end of file diff --git a/src/SlatedGameToolkit.Framework/Graphics/Camera2D.cs b/src/SlatedGameToolkit.Framework/Graphics/Camera2D.cs index 4fd0b4c..0108165 100644 --- a/src/SlatedGameToolkit.Framework/Graphics/Camera2D.cs +++ b/src/SlatedGameToolkit.Framework/Graphics/Camera2D.cs @@ -23,7 +23,7 @@ namespace SlatedGameToolkit.Framework.Graphics } } - public Camera2D(int width, int height) : base(width, height) { + public Camera2D(float width, float height) : base(width, height) { this.Orthographic = true; this.LockedOrientation = true; this.CameraFront = -Vector3.UnitZ; diff --git a/src/SlatedGameToolkit.Tools/Utilities/Playground/MainState.cs b/src/SlatedGameToolkit.Tools/Utilities/Playground/MainState.cs index ef4cc87..6800451 100644 --- a/src/SlatedGameToolkit.Tools/Utilities/Playground/MainState.cs +++ b/src/SlatedGameToolkit.Tools/Utilities/Playground/MainState.cs @@ -52,7 +52,9 @@ namespace SlatedGameToolkit.Tools.Utilities.Playground public unsafe void Initialize(StateManager manager) { window = new WindowContext("SlatedGameToolkit Playground"); - camera = new Camera2D(2, 2); + Vector2 drawableDimensions = window.GetDrawableDimensions(); + float ratio = drawableDimensions.Y / drawableDimensions.X; + camera = new Camera2D(2f, ratio * 2f); renderer = new MeshBatch(camera); logoTexture = TextureLoader.Load2DTexture("Resources/Playground/yhdnbgnc.png"); @@ -71,7 +73,7 @@ namespace SlatedGameToolkit.Tools.Utilities.Playground untextured = new RectangleMesh(null, Color.Red); untextured.Width = 0.15f; - untextured.Height = 0.1f; + untextured.Height = 0.15f; untextured.X = 0.25f; untextured.Y = - 0.15f;