This commit is contained in:
maxwes08
2026-05-25 09:44:23 +02:00
parent e1778fb446
commit 38db4ce6b9
7 changed files with 13 additions and 10 deletions

View File

@@ -32,7 +32,7 @@ namespace Voxel.Core
while (_tickTime >= TICK_LENGTH) while (_tickTime >= TICK_LENGTH)
{ {
_tickTime -= TICK_LENGTH; _tickTime -= TICK_LENGTH;
Tick(); // run exactly once per tick Tick();
} }
if (Input.GetKey(Keys.Escape)) if (Input.GetKey(Keys.Escape))

View File

@@ -136,7 +136,6 @@ namespace Voxel.Graphics
_uiShader.SetMatrix4("projection", projection); _uiShader.SetMatrix4("projection", projection);
_uiTexture.Bind(TextureUnit.Texture0); _uiTexture.Bind(TextureUnit.Texture0);
_guiBatcher.DrawString("Voxel Engine v0.1", 16, 112, 24, Vector4.One);
_guiBatcher.Render(); _guiBatcher.Render();

View File

@@ -5,7 +5,7 @@ in vec4 Color;
out vec4 FragColor; out vec4 FragColor;
uniform sampler2D uTexture; // Ensure this name matches C# exactly uniform sampler2D uTexture;
void main() void main()
{ {

View File

@@ -7,11 +7,10 @@ layout (location = 2) in vec4 aColor;
out vec2 TexCoord; out vec2 TexCoord;
out vec4 Color; out vec4 Color;
uniform mat4 projection; // Ensure this name matches C# exactly uniform mat4 projection;
void main() void main()
{ {
// If you don't multiply by projection, the compiler deletes the uniform
gl_Position = projection * vec4(aPos, 0.0, 1.0); gl_Position = projection * vec4(aPos, 0.0, 1.0);
TexCoord = aTexCoord; TexCoord = aTexCoord;
Color = aColor; Color = aColor;

View File

@@ -3,12 +3,9 @@ public static class CharWidth
private static readonly Dictionary<char, float> CharWidths = new Dictionary<char, float>(); private static readonly Dictionary<char, float> CharWidths = new Dictionary<char, float>();
static CharWidth() static CharWidth()
{ { for (char c = (char)32; c <= (char)126; c++)
// Default for all ASCII
for (char c = (char)32; c <= (char)126; c++)
CharWidths[c] = 5.0f; CharWidths[c] = 5.0f;
// Override exceptions
CharWidths[' '] = 3.0f; CharWidths[' '] = 3.0f;
CharWidths['!'] = 1.0f; CharWidths['!'] = 1.0f;
CharWidths['"'] = 3.0f; CharWidths['"'] = 3.0f;

View File

@@ -28,7 +28,6 @@ public class GuiBatcher
public void DrawQuad(float x, float y, float w, float h, Vector4 uv, Vector4 color) 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, 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 + w, y, uv.Z, uv.Y, color)); // TR
_vertices.Add(new UiVertex(x, y + h, uv.X, uv.W, color)); // BL _vertices.Add(new UiVertex(x, y + h, uv.X, uv.W, color)); // BL

View File

@@ -13,6 +13,9 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Update="Assets\ascii.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Assets\atlas.png"> <None Update="Assets\atlas.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None> </None>
@@ -22,6 +25,12 @@
<None Update="Shaders\shader.vert"> <None Update="Shaders\shader.vert">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None> </None>
<None Update="Shaders\ui.frag">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Shaders\ui.vert">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup> </ItemGroup>
</Project> </Project>