From cc755411375c23a4bd442fd3f2243e77b32aaa86 Mon Sep 17 00:00:00 2001 From: copygirl Date: Fri, 5 Apr 2024 16:26:46 +0200 Subject: [PATCH] Update to Zig 2024.3.0-mach --- README.md | 2 +- build.zig | 11 ++++++++--- build.zig.zon | 10 +++++----- src/main.zig | 2 +- src/primitives.zig | 3 +-- src/renderer.zig | 2 +- 6 files changed, 17 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 31a3551..4cc6ddc 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Zig Bloxel Game -This is a small project attempting to create a "bloxel" game (think Minecraft) using the relatively new [Zig] programming language with the help of [Mach], [Flecs] and [zig-gamedev]. Due to Zig being a quickly evolving language, Mach and zig-gamedev, and as a result this project, target version `0.12.0-dev.2063+804cee3b9` of Zig. Consider using [zigup] to manage multiple compiler versions. +This is a small project attempting to create a "bloxel" game (think Minecraft) using the relatively new [Zig] programming language with the help of [Mach], [Flecs] and [zig-gamedev]. Due to Zig being a quickly evolving language, Mach and zig-gamedev, and as a result this project, target version `0.12.0-dev.3180+83e578a18` (aka `2024.3.0-mach`) of Zig. Consider using [zigup] to manage multiple compiler versions. With this project I'm learning new things and adding functionality step by step, then documenting my knowledge with lots of comments. Each substantial commit to this repository should cover a manageable chunk of changes, which ideally anyone interested should be able to follow along with. Hopefully this can act as a resource for people trying to learn something about game development with Zig and the other tools used here. diff --git a/build.zig b/build.zig index 7f6fbdf..05b1964 100644 --- a/build.zig +++ b/build.zig @@ -1,16 +1,21 @@ const std = @import("std"); -const mach_core = @import("mach_core"); +const mach = @import("mach"); const zmath = @import("zmath"); pub fn build(b: *std.Build) !void { const target = b.standardTargetOptions(.{}); const optimize = b.standardOptimizeOption(.{}); - const mach_core_dep = b.dependency("mach_core", .{ .target = target, .optimize = optimize }); + const mach_dep = b.dependency("mach", .{ + .target = target, + .optimize = optimize, + // Only using mach.core, avoid pulling unnecessary dependencies. + .core = true, + }); const zigimg_dep = b.dependency("zigimg", .{ .target = target, .optimize = optimize }); const zmath_pkg = zmath.package(b, target, optimize, .{}); - const app = try mach_core.App.init(b, mach_core_dep.builder, .{ + const app = try mach.CoreApp.init(b, mach_dep.builder, .{ .name = "zig-bloxel-game", .src = "src/main.zig", .target = target, diff --git a/build.zig.zon b/build.zig.zon index 539df80..d959def 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -10,13 +10,13 @@ }, .dependencies = .{ - .mach_core = .{ - .url = "https://pkg.machengine.org/mach-core/6a62bcc90e0d072d632788a6575d77942bd09a19.tar.gz", - .hash = "12209d39954fcda0be158461c10f64d14d5c7d097bd6d26785b332d75ffefa7dd7a0", + .mach = .{ + .url = "https://pkg.machengine.org/mach/279290bbf2f1adab0af00323280a07d6bfff47a5.tar.gz", + .hash = "1220ba5472217ef81455b19d540967049bbfaf768b30d04534865707e907ee1c4aec", }, .zigimg = .{ - .url = "https://github.com/zigimg/zigimg/archive/ad6ad042662856f55a4d67499f1c4606c9951031.tar.gz", - .hash = "1220bf6b616ca219f95be1205b12aa8cdb7e09838fcebeae90b48b5ab0a030c5ab45", + .url = "https://github.com/zigimg/zigimg/archive/8873f29fc449e1b63400e9f4ad86d3c76204f962.tar.gz", + .hash = "122019f6439545235af116d0d8eb81fde1ff05fdb070da57c723772c557f84c5bf39", }, .zmath = .{ .path = "libs/zig-gamedev/libs/zmath" }, }, diff --git a/src/main.zig b/src/main.zig index 57c31a8..8d87be3 100644 --- a/src/main.zig +++ b/src/main.zig @@ -1,7 +1,7 @@ const std = @import("std"); const GeneralPurposeAllocator = std.heap.GeneralPurposeAllocator(.{}); -const core = @import("mach-core"); +const core = @import("mach").core; const Renderer = @import("./renderer.zig"); pub const App = @This(); diff --git a/src/primitives.zig b/src/primitives.zig index 4f3ba54..4e1a890 100644 --- a/src/primitives.zig +++ b/src/primitives.zig @@ -1,8 +1,7 @@ const std = @import("std"); const tau = std.math.tau; -const core = @import("mach-core"); -const gpu = core.gpu; +const gpu = @import("mach").core.gpu; const Renderer = @import("./renderer.zig"); const createAndWriteBuffer = Renderer.createAndWriteBuffer; diff --git a/src/renderer.zig b/src/renderer.zig index 48b8304..fc41ec6 100644 --- a/src/renderer.zig +++ b/src/renderer.zig @@ -4,7 +4,7 @@ const zigimg = @import("zigimg"); const Rgb24 = zigimg.color.Rgb24; const Rgba32 = zigimg.color.Rgba32; -const core = @import("mach-core"); +const core = @import("mach").core; const gpu = core.gpu; const zm = @import("zmath");