From 35985df6110a9090fca4e8f4ff6bcf55f4801548 Mon Sep 17 00:00:00 2001 From: matthew Date: Wed, 22 Oct 2025 06:09:59 +1100 Subject: [PATCH] update submodules, project compiles again --- .gitmodules | 6 +++--- build.sh | 2 +- dub.json | 4 ++-- src/DLibs | 1 - src/VulkanRenderer | 2 +- src/dlib | 1 + src/gears/game.d | 38 ++++++++++++++++---------------------- src/gears/main.d | 9 ++------- src/gears/tests.d | 4 +--- src/packer/packer.d | 5 +---- src/to_rework/math.d | 4 +--- 11 files changed, 29 insertions(+), 47 deletions(-) delete mode 160000 src/DLibs create mode 160000 src/dlib diff --git a/.gitmodules b/.gitmodules index 9f6600c..1843e08 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,6 @@ [submodule "src/VulkanRenderer"] path = src/VulkanRenderer url = https://git.sleepy.day/sleepy-day/VulkanRenderer.git -[submodule "src/DLibs"] - path = src/DLibs - url = https://git.sleepy.day/sleepy-day/DLibs.git +[submodule "src/dlib"] + path = src/dlib + url = https://git.sleepy.day/sleepy-day/dlib diff --git a/build.sh b/build.sh index bb8d361..29aff7d 100755 --- a/build.sh +++ b/build.sh @@ -28,4 +28,4 @@ done /bin/bash src/VulkanRenderer/build.sh build -/bin/bash src/DLibs/build.sh build +/bin/bash src/dlib/build.sh build diff --git a/dub.json b/dub.json index 2bad137..9dcb5f0 100644 --- a/dub.json +++ b/dub.json @@ -9,8 +9,8 @@ "targetPath": "build", "sourceFiles-linux": ["build/libvma.a", "build/libstb.a", "build/libm3d.a", "build/libcglm.a"], "sourceFiles-windows": [], - "importPaths": ["src/gears", "src/DLibs", "src/DLibs/external/xxhash", "src/VulkanRenderer"], - "sourcePaths": ["src/gears", "src/DLibs", "src/DLibs/external/xxhash", "src/VulkanRenderer"], + "importPaths": ["src/gears", "src/dlib", "src/dlib/external/xxhash", "src/VulkanRenderer"], + "sourcePaths": ["src/gears", "src/dlib", "src/dlib/external/xxhash", "src/VulkanRenderer"], "libs-linux": ["xcb", "X11", "X11-xcb", "vulkan", "stdc++", "xcb-xfixes", "freetype"], "libs-windows": [], "preGenerateCommands-linux": ["./build.sh"], diff --git a/src/DLibs b/src/DLibs deleted file mode 160000 index 3c6d214..0000000 --- a/src/DLibs +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3c6d214aa7e3058f8de1a4ff380fd1bb8ce56036 diff --git a/src/VulkanRenderer b/src/VulkanRenderer index 7a10601..1290c5f 160000 --- a/src/VulkanRenderer +++ b/src/VulkanRenderer @@ -1 +1 @@ -Subproject commit 7a10601f51b651db006de6d1c5cafb547f90dc87 +Subproject commit 1290c5f45ac49cc5534817e8d6b0adae4ac058af diff --git a/src/dlib b/src/dlib new file mode 160000 index 0000000..a97309c --- /dev/null +++ b/src/dlib @@ -0,0 +1 @@ +Subproject commit a97309cb04e0e802047586a5bacbacc9b8e9649b diff --git a/src/gears/game.d b/src/gears/game.d index b22bab0..639e587 100644 --- a/src/gears/game.d +++ b/src/gears/game.d @@ -1,16 +1,9 @@ -import aliases; -import includes; +import dlib; public import vulkan : PlatformHandles; import vulkan : Destroy; import vulkan; -import assets; -import util; -import alloc; -import platform; -import math; import core.stdc.math : cosf, sinf; import std.algorithm.sorting; -import fonts; import main; const UI_COUNT = 50000; @@ -69,6 +62,7 @@ struct Game Renderer rd; Arena arena; Arena frame_arena; + Inputs* inputs; PlatformWindow* window; @@ -188,7 +182,7 @@ Copy(Model* dst, Model* src) void ProcessInputs(Game* g, Camera* cam) { - HandleInputs(cam, &g.window.inputs); + HandleInputs(cam, g.inputs); } void @@ -285,9 +279,9 @@ struct Camera pragma(inline): void HandleInputs(Camera* cam, Inputs* inputs) { - foreach(i; 0 .. inputs.count) + for(auto n = inputs.list.first; n != null; n = n.next) { - InputEvent event = inputs.events[i]; + InputEvent* event = &n.value; switch(event.key) { case Input.W: cam.velocity.z = event.pressed ? -1.0 : 0.0; break; @@ -335,7 +329,7 @@ Update(Camera* cam) void Sort(Game* g, Vec3 pos, Model* model) { - f32[] lengths = AllocArray!(f32)(&g.frame_arena, model.positions.length); + f32[] lengths = Alloc!(f32)(&g.frame_arena, model.positions.length); foreach(i; 0 .. lengths.length) { @@ -434,8 +428,8 @@ LoadModel(Game* g, string name) m3d_t* m3d = m3d_load(data.ptr, null, null, null); scope(exit) m3d_free(m3d); - u32[] tex_lookup = AllocArray!(u32)(&g.frame_arena, m3d.numtexture); - model.textures = AllocArray!(ImageView)(&g.arena, m3d.numtexture); + u32[] tex_lookup = Alloc!(u32)(&g.frame_arena, m3d.numtexture); + model.textures = Alloc!(ImageView)(&g.arena, m3d.numtexture); foreach(i; 0 .. m3d.numtexture) { u32 w = m3d.texture[i].w; u32 h = m3d.texture[i].h; u32 ch = m3d.texture[i].f; @@ -447,9 +441,9 @@ LoadModel(Game* g, string name) //tex_lookup[i] = Pop(&g.rd, DT.SampledImage); } - Material[] mats = AllocArray!(Material)(&g.frame_arena, m3d.nummaterial); - u32[] mat_lookup = AllocArray!(u32)(&g.frame_arena, m3d.nummaterial); - model.materials = AllocArray!(Buffer)(&g.arena, m3d.nummaterial); + Material[] mats = Alloc!(Material)(&g.frame_arena, m3d.nummaterial); + u32[] mat_lookup = Alloc!(u32)(&g.frame_arena, m3d.nummaterial); + model.materials = Alloc!(Buffer)(&g.arena, m3d.nummaterial); foreach(i; 0 .. m3d.nummaterial) { const(char)[] mat_name = m3d.material[i].name[0 .. strlen(m3d.material[i].name)]; @@ -504,7 +498,7 @@ LoadModel(Game* g, string name) } } - model.parts = AllocArray!(MeshPart)(&g.arena, mesh_count); + model.parts = Alloc!(MeshPart)(&g.arena, mesh_count); last = u64.max; u32 index = 0; foreach(i; 0 .. m3d.numface) @@ -535,10 +529,10 @@ LoadModel(Game* g, string name) m3dv_t* vertex; - u32[] indices = AllocArray!(u32)(&g.arena, m3d.numface * 3); - Vertex[] vertices = AllocArray!(Vertex)(&g.frame_arena, m3d.numface * 3); - Vec3[] positions = AllocArray!(Vec3)(&g.arena, m3d.numface); - u32[] pos_indices = AllocArray!(u32)(&g.arena, m3d.numface); + u32[] indices = Alloc!(u32)(&g.arena, m3d.numface * 3); + Vertex[] vertices = Alloc!(Vertex)(&g.frame_arena, m3d.numface * 3); + Vec3[] positions = Alloc!(Vec3)(&g.arena, m3d.numface); + u32[] pos_indices = Alloc!(u32)(&g.arena, m3d.numface); foreach(i; 0 .. m3d.numface) { diff --git a/src/gears/main.d b/src/gears/main.d index c6c73bd..0c0a676 100644 --- a/src/gears/main.d +++ b/src/gears/main.d @@ -1,14 +1,9 @@ -import includes; +import dlib; import std.stdio; -import aliases; import core.memory; -import platform; import game; -import util; import core.simd; -import math; import core.stdc.string : memcpy; -import fonts; // TODO: // 1. Determine how to better handle inputs @@ -25,7 +20,7 @@ void main(string[] argv) while (true) { - HandleEvents(&window); + g.inputs = GetInputs(&window); if (window.close) { break; diff --git a/src/gears/tests.d b/src/gears/tests.d index c0049d1..fc61c78 100644 --- a/src/gears/tests.d +++ b/src/gears/tests.d @@ -1,3 +1 @@ -import aliases; -import util; - +import dlib; diff --git a/src/packer/packer.d b/src/packer/packer.d index 9e950df..59f3c81 100644 --- a/src/packer/packer.d +++ b/src/packer/packer.d @@ -1,11 +1,8 @@ -import aliases; -import includes; +import dlib; import std.stdio; import std.string; import std.file; -import util; import std.path; -import assets; import std.traits; import std.algorithm.comparison; import core.memory; diff --git a/src/to_rework/math.d b/src/to_rework/math.d index 93d1081..9511765 100644 --- a/src/to_rework/math.d +++ b/src/to_rework/math.d @@ -1,10 +1,8 @@ -import aliases; -import util; +import dlib; import std.math; import std.math.algebraic; import core.stdc.math : tanf, cosf, sinf, sqrtf; import std.traits; -import inteli; import std.meta; import std.format; import std.stdio;