Update to Zig 2024.3.0-mach

main
copygirl 5 months ago
parent 39c2eb6781
commit cc75541137
  1. 2
      README.md
  2. 11
      build.zig
  3. 10
      build.zig.zon
  4. 2
      src/main.zig
  5. 3
      src/primitives.zig
  6. 2
      src/renderer.zig

@ -1,6 +1,6 @@
# Zig Bloxel Game # 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. 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.

@ -1,16 +1,21 @@
const std = @import("std"); const std = @import("std");
const mach_core = @import("mach_core"); const mach = @import("mach");
const zmath = @import("zmath"); const zmath = @import("zmath");
pub fn build(b: *std.Build) !void { pub fn build(b: *std.Build) !void {
const target = b.standardTargetOptions(.{}); const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{}); 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 zigimg_dep = b.dependency("zigimg", .{ .target = target, .optimize = optimize });
const zmath_pkg = zmath.package(b, target, 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", .name = "zig-bloxel-game",
.src = "src/main.zig", .src = "src/main.zig",
.target = target, .target = target,

@ -10,13 +10,13 @@
}, },
.dependencies = .{ .dependencies = .{
.mach_core = .{ .mach = .{
.url = "https://pkg.machengine.org/mach-core/6a62bcc90e0d072d632788a6575d77942bd09a19.tar.gz", .url = "https://pkg.machengine.org/mach/279290bbf2f1adab0af00323280a07d6bfff47a5.tar.gz",
.hash = "12209d39954fcda0be158461c10f64d14d5c7d097bd6d26785b332d75ffefa7dd7a0", .hash = "1220ba5472217ef81455b19d540967049bbfaf768b30d04534865707e907ee1c4aec",
}, },
.zigimg = .{ .zigimg = .{
.url = "https://github.com/zigimg/zigimg/archive/ad6ad042662856f55a4d67499f1c4606c9951031.tar.gz", .url = "https://github.com/zigimg/zigimg/archive/8873f29fc449e1b63400e9f4ad86d3c76204f962.tar.gz",
.hash = "1220bf6b616ca219f95be1205b12aa8cdb7e09838fcebeae90b48b5ab0a030c5ab45", .hash = "122019f6439545235af116d0d8eb81fde1ff05fdb070da57c723772c557f84c5bf39",
}, },
.zmath = .{ .path = "libs/zig-gamedev/libs/zmath" }, .zmath = .{ .path = "libs/zig-gamedev/libs/zmath" },
}, },

@ -1,7 +1,7 @@
const std = @import("std"); const std = @import("std");
const GeneralPurposeAllocator = std.heap.GeneralPurposeAllocator(.{}); const GeneralPurposeAllocator = std.heap.GeneralPurposeAllocator(.{});
const core = @import("mach-core"); const core = @import("mach").core;
const Renderer = @import("./renderer.zig"); const Renderer = @import("./renderer.zig");
pub const App = @This(); pub const App = @This();

@ -1,8 +1,7 @@
const std = @import("std"); const std = @import("std");
const tau = std.math.tau; const tau = std.math.tau;
const core = @import("mach-core"); const gpu = @import("mach").core.gpu;
const gpu = core.gpu;
const Renderer = @import("./renderer.zig"); const Renderer = @import("./renderer.zig");
const createAndWriteBuffer = Renderer.createAndWriteBuffer; const createAndWriteBuffer = Renderer.createAndWriteBuffer;

@ -4,7 +4,7 @@ const zigimg = @import("zigimg");
const Rgb24 = zigimg.color.Rgb24; const Rgb24 = zigimg.color.Rgb24;
const Rgba32 = zigimg.color.Rgba32; const Rgba32 = zigimg.color.Rgba32;
const core = @import("mach-core"); const core = @import("mach").core;
const gpu = core.gpu; const gpu = core.gpu;
const zm = @import("zmath"); const zm = @import("zmath");

Loading…
Cancel
Save