Added ui labels for debugging and playability
This commit is contained in:
@@ -14,8 +14,8 @@ namespace Voxel.Graphics
|
||||
public static float Speed = 5f;
|
||||
public static float ShiftSpeed = 20f;
|
||||
|
||||
private static int _width;
|
||||
private static int _height;
|
||||
public static int Width;
|
||||
public static int Height;
|
||||
|
||||
public static Matrix4 view =>
|
||||
Matrix4.LookAt(Position, Position + Front, Vector3.UnitY);
|
||||
@@ -47,7 +47,7 @@ namespace Voxel.Graphics
|
||||
public static void UpdateProjection()
|
||||
{
|
||||
float fov = MathHelper.DegreesToRadians(FOV);
|
||||
float aspectRatio = _width / (float)_height;
|
||||
float aspectRatio = Width / (float)Height;
|
||||
float near = 0.1f;
|
||||
float far = 1000f;
|
||||
|
||||
@@ -56,8 +56,8 @@ namespace Voxel.Graphics
|
||||
|
||||
public static void UpdateSize(int width, int height)
|
||||
{
|
||||
_width = width;
|
||||
_height = height;
|
||||
Width = width;
|
||||
Height = height;
|
||||
UpdateProjection();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using OpenTK.Graphics.OpenGL4;
|
||||
using OpenTK.Mathematics;
|
||||
using Voxel.Core;
|
||||
using Voxel.UI;
|
||||
|
||||
namespace Voxel.Graphics
|
||||
{
|
||||
@@ -131,11 +132,11 @@ namespace Voxel.Graphics
|
||||
|
||||
_uiShader.Use();
|
||||
|
||||
Matrix4 projection = Matrix4.CreateOrthographicOffCenter(0, WindowWidth, WindowHeight, 0, -1, 1);
|
||||
Matrix4 projection = Matrix4.CreateOrthographicOffCenter(0, Camera.Width, Camera.Height, 0, -1, 1);
|
||||
_uiShader.SetMatrix4("projection", projection);
|
||||
|
||||
_uiTexture.Bind(TextureUnit.Texture0);
|
||||
_guiBatcher.DrawString("Voxel Engine v0.1", 15, 70, 20, Vector4.One);
|
||||
_guiBatcher.DrawString("Voxel Engine v0.1", 16, 112, 24, Vector4.One);
|
||||
|
||||
_guiBatcher.Render();
|
||||
|
||||
@@ -174,5 +175,11 @@ namespace Voxel.Graphics
|
||||
{
|
||||
_buffersDirty = true;
|
||||
}
|
||||
|
||||
//temp
|
||||
public static void RenderLabel(Label label)
|
||||
{
|
||||
_guiBatcher.DrawString(label.Text, label.X, label.Y, label.Size, label.Color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user