From 38db4ce6b96b873c3463d6f2d451bf312d3806c9 Mon Sep 17 00:00:00 2001 From: maxwes08 Date: Mon, 25 May 2026 09:44:23 +0200 Subject: [PATCH] cleanup --- Core/Window.cs | 2 +- Graphics/Renderer.cs | 1 - Shaders/ui.frag | 2 +- Shaders/ui.vert | 3 +-- UI/CharData.cs | 5 +---- UI/GuiBatcher.cs | 1 - Voxel.csproj | 9 +++++++++ 7 files changed, 13 insertions(+), 10 deletions(-) diff --git a/Core/Window.cs b/Core/Window.cs index 9109ee0..0a6fcc5 100644 --- a/Core/Window.cs +++ b/Core/Window.cs @@ -32,7 +32,7 @@ namespace Voxel.Core while (_tickTime >= TICK_LENGTH) { _tickTime -= TICK_LENGTH; - Tick(); // run exactly once per tick + Tick(); } if (Input.GetKey(Keys.Escape)) diff --git a/Graphics/Renderer.cs b/Graphics/Renderer.cs index 84cc19a..e4567d1 100644 --- a/Graphics/Renderer.cs +++ b/Graphics/Renderer.cs @@ -136,7 +136,6 @@ namespace Voxel.Graphics _uiShader.SetMatrix4("projection", projection); _uiTexture.Bind(TextureUnit.Texture0); - _guiBatcher.DrawString("Voxel Engine v0.1", 16, 112, 24, Vector4.One); _guiBatcher.Render(); diff --git a/Shaders/ui.frag b/Shaders/ui.frag index 83043a0..389d33e 100644 --- a/Shaders/ui.frag +++ b/Shaders/ui.frag @@ -5,7 +5,7 @@ in vec4 Color; out vec4 FragColor; -uniform sampler2D uTexture; // Ensure this name matches C# exactly +uniform sampler2D uTexture; void main() { diff --git a/Shaders/ui.vert b/Shaders/ui.vert index 59770e6..0425d8c 100644 --- a/Shaders/ui.vert +++ b/Shaders/ui.vert @@ -7,11 +7,10 @@ layout (location = 2) in vec4 aColor; out vec2 TexCoord; out vec4 Color; -uniform mat4 projection; // Ensure this name matches C# exactly +uniform mat4 projection; void main() { - // If you don't multiply by projection, the compiler deletes the uniform gl_Position = projection * vec4(aPos, 0.0, 1.0); TexCoord = aTexCoord; Color = aColor; diff --git a/UI/CharData.cs b/UI/CharData.cs index 286a54c..ab33309 100644 --- a/UI/CharData.cs +++ b/UI/CharData.cs @@ -3,12 +3,9 @@ public static class CharWidth private static readonly Dictionary CharWidths = new Dictionary(); static CharWidth() - { - // Default for all ASCII - for (char c = (char)32; c <= (char)126; c++) + { for (char c = (char)32; c <= (char)126; c++) CharWidths[c] = 5.0f; - // Override exceptions CharWidths[' '] = 3.0f; CharWidths['!'] = 1.0f; CharWidths['"'] = 3.0f; diff --git a/UI/GuiBatcher.cs b/UI/GuiBatcher.cs index 144a24e..51cf3d1 100644 --- a/UI/GuiBatcher.cs +++ b/UI/GuiBatcher.cs @@ -28,7 +28,6 @@ public class GuiBatcher public void DrawQuad(float x, float y, float w, float h, Vector4 uv, Vector4 color) { - // Two triangles (Standard Minecraft Blit) _vertices.Add(new UiVertex(x, y, uv.X, uv.Y, color)); // TL _vertices.Add(new UiVertex(x + w, y, uv.Z, uv.Y, color)); // TR _vertices.Add(new UiVertex(x, y + h, uv.X, uv.W, color)); // BL diff --git a/Voxel.csproj b/Voxel.csproj index 3b66508..2ba9f56 100644 --- a/Voxel.csproj +++ b/Voxel.csproj @@ -13,6 +13,9 @@ + + Always + Always @@ -22,6 +25,12 @@ Always + + Always + + + Always +