diff --git a/build.zig b/build.zig index 66db99a..1ae1ff9 100644 --- a/build.zig +++ b/build.zig @@ -74,43 +74,6 @@ pub fn build(b: *std.Build) !void { app.compile.addIncludePath(.{ .path = root_path ++ "libs/zig-bass/src" }); - // if (target.isDarwin()) { - // exe.addIncludePath(.{ .path = root_path ++ "libs/system-sdk/macos12/usr/include" }); - // exe.addFrameworkPath(.{ .path = root_path ++ "libs/system-sdk/macos12/System/Library/Frameworks" }); - // exe.addLibraryPath(.{ .path = root_path ++ "libs/system-sdk/macos12/usr/lib" }); - - // if (!builtin.target.isDarwin()) { - // b.sysroot = root_path ++ "libs/system-sdk/macos12"; - // } - - // exe.linkFramework("Metal"); - // exe.linkFramework("QuartzCore"); - // exe.linkFramework("Foundation"); - - // exe.linkSystemLibrary("objc"); - // } - - // if (target.isLinux() and !target.isNative()) { - // exe.addIncludePath(.{ .path = root_path ++ "libs/system-sdk/linux/include" }); - // exe.addLibraryPath(.{ .path = b.fmt(root_path ++ "libs/system-sdk/linux/lib/{s}", .{try target.linuxTriple(b.allocator)}) }); - // } - - { //zig-bass - } //zig-bass - - // { //cimgui - // const cimgui_lib = try cimgui.create_cimgui(b, target, optimize); - - // cimgui_lib.installLibraryHeaders(sdl_lib); - // cimgui_lib.linkLibrary(sdl_lib); - // try cimgui_lib.lib_paths.appendSlice(sdl_lib.lib_paths.items); - // try cimgui_lib.include_dirs.appendSlice(sdl_lib.include_dirs.items); - - // exe.addIncludePath(.{ .path = "libs/cimgui/" }); - - // exe.linkLibrary(cimgui_lib); - // } //cimgui - { //iconv const iconv_lib = iconv.createIconv(b, target, optimize); @@ -147,23 +110,23 @@ pub fn build(b: *std.Build) !void { }); b.installArtifact(tempo); - // const clap = b.dependency("clap", .{}); - // const fumen_compile = b.addExecutable(.{ - // .name = "fumen_compile", - // .root_source_file = .{ .path = root_path ++ "util/fumen_compile.zig" }, - // .target = target, - // .optimize = optimize, - // }); - // fumen_compile.root_module.addImport("clap", clap.module("clap")); - // b.installArtifact(fumen_compile); - - // const fumen_compile_cmd = b.addRunArtifact(fumen_compile); - // fumen_compile_cmd.step.dependOn(b.getInstallStep()); - // if (b.args) |args| { - // fumen_compile_cmd.addArgs(args); - // } - // const fumen_compile_step = b.step("fumen_compile", "Run the fumen compiler"); - // fumen_compile_step.dependOn(&fumen_compile_cmd.step); + const clap = b.dependency("clap", .{}); + const fumen_compile = b.addExecutable(.{ + .name = "fumen_compile", + .root_source_file = .{ .path = root_path ++ "util/fumen_compile.zig" }, + .target = target, + .optimize = optimize, + }); + fumen_compile.root_module.addImport("clap", clap.module("clap")); + b.installArtifact(fumen_compile); + + const fumen_compile_cmd = b.addRunArtifact(fumen_compile); + fumen_compile_cmd.step.dependOn(b.getInstallStep()); + if (b.args) |args| { + fumen_compile_cmd.addArgs(args); + } + const fumen_compile_step = b.step("fumen_compile", "Run the fumen compiler"); + fumen_compile_step.dependOn(&fumen_compile_cmd.step); const tempo_cmd = b.addRunArtifact(tempo); tempo_cmd.step.dependOn(b.getInstallStep()); diff --git a/build.zig.zon b/build.zig.zon index 3a0c450..479daf1 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -14,10 +14,10 @@ .url = "https://github.com/Beyley/zigimg/archive/d54b946d4b33cf1a18c31ab8ce6a1b4e4f7c2d38.tar.gz", .hash = "1220a1ac633472925863401189e4de1cbf441736dd100c17c19a837ee0f31632d647", }, - // .clap = .{ - // .url = "https://github.com/Hejsil/zig-clap/archive/f49b94700e0761b7514abdca0e4f0e7f3f938a93.tar.gz", - // .hash = "1220f48518ce22882e102255ed3bcdb7aeeb4891f50b2cdd3bd74b5b2e24d3149ba2", - // }, + .clap = .{ + .url = "https://github.com/Hejsil/zig-clap/archive/0f2db7700b05356ebb1ccddbbf1797048925f072.tar.gz", + .hash = "12203896de6eedec14712f4f1eaac8b646939cfed213c56accf231a0abb05f9dbb77", + }, }, .paths = .{ "game/", diff --git a/game/app.zig b/game/app.zig index 35e9aff..1589e3f 100644 --- a/game/app.zig +++ b/game/app.zig @@ -130,8 +130,6 @@ pub fn deinit(app: *App) void { } pub fn update(app: *App) !bool { - std.debug.print("update\n", .{}); - //Get the top screen var screen = app.screen_stack.top(); @@ -211,5 +209,8 @@ pub fn update(app: *App) !bool { screen.screen_push = null; } + if (!app.is_running) + return true; + return false; } diff --git a/game/gfx.zig b/game/gfx.zig index 1414859..0f325f3 100644 --- a/game/gfx.zig +++ b/game/gfx.zig @@ -505,15 +505,15 @@ pub fn createBuffer(comptime contents_type: type, count: u64, buffer_type: core. pub fn setErrorCallbacks(self: *Self) void { _ = self; // autofix - // core.device.setUncapturedErrorCallback({}, uncapturedError); + core.device.setUncapturedErrorCallback({}, uncapturedError); std.debug.print("setup wgpu device callbacks\n", .{}); } -fn uncapturedError(ctx: void, error_type: core.gpu.ErrorType, message: [*:0]const u8) void { +inline fn uncapturedError(ctx: void, error_type: core.gpu.ErrorType, message: [*:0]const u8) void { _ = ctx; // autofix - std.debug.print("Got uncaptured error {d} with message {s}\n", .{ error_type, std.mem.span(message) }); + std.debug.print("Got uncaptured error {s} with message {s}\n", .{ @tagName(error_type), std.mem.span(message) }); // @panic("uncaptured wgpu error"); } @@ -540,6 +540,7 @@ pub fn updateProjectionMatrixBuffer(self: *Self) void { 1, ); + std.debug.print("thsathss {}\n", .{mat}); core.queue.writeBuffer(self.projection_matrix_buffer, 0, &[_]math.Mat4x4{mat}); } diff --git a/util/fumen_compile.zig b/util/fumen_compile.zig index 4b0d0d7..a3eef00 100644 --- a/util/fumen_compile.zig +++ b/util/fumen_compile.zig @@ -63,6 +63,7 @@ pub fn main() !void { var diag = clap.Diagnostic{}; var res = clap.parse(clap.Help, ¶ms, clap.parsers.default, .{ .diagnostic = &diag, + .allocator = allocator, }) catch |err| { // Report useful error and exit diag.report(io.getStdErr().writer(), err) catch {};