Mainstate view ratio corrected, camera2D takes float dimensions now.
added additional debug logging.
This commit is contained in:
parent
319ade258e
commit
80adda7afb
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user