commit
5774e2f239
8 changed files with 105 additions and 0 deletions
@ -0,0 +1,9 @@ |
|||||||
|
root = true |
||||||
|
|
||||||
|
[*] |
||||||
|
charset = utf-8 |
||||||
|
end_of_line = lf |
||||||
|
indent_style = space |
||||||
|
indent_size = 4 |
||||||
|
trim_trailing_whitespace = true |
||||||
|
insert_final_newline = true |
@ -0,0 +1,2 @@ |
|||||||
|
/zig-cache/ |
||||||
|
/zig-out/ |
@ -0,0 +1,12 @@ |
|||||||
|
{ |
||||||
|
"version": "0.2.0", |
||||||
|
"configurations": [{ |
||||||
|
"name": "Debug", |
||||||
|
"type": "lldb", |
||||||
|
"preLaunchTask": "build", |
||||||
|
"request": "launch", |
||||||
|
"cwd": "${workspaceFolder}", |
||||||
|
"program": "${workspaceFolder}/zig-out/bin/zig-bloxel-game", |
||||||
|
"args": [], |
||||||
|
}] |
||||||
|
} |
@ -0,0 +1,16 @@ |
|||||||
|
{ |
||||||
|
"version": "2.0.0", |
||||||
|
"tasks": [{ |
||||||
|
"label": "build", |
||||||
|
"group": { "kind": "build", "isDefault": true }, |
||||||
|
"type": "shell", |
||||||
|
"command": "zig build", |
||||||
|
"problemMatcher": [] |
||||||
|
},{ |
||||||
|
"label": "test", |
||||||
|
"group": { "kind": "test", "isDefault": true }, |
||||||
|
"type": "shell", |
||||||
|
"command": "zig build test", |
||||||
|
"problemMatcher": [] |
||||||
|
}] |
||||||
|
} |
@ -0,0 +1,7 @@ |
|||||||
|
# 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] and [Flecs]. |
||||||
|
|
||||||
|
[Zig]: https://ziglang.org/ |
||||||
|
[Mach]: https://machengine.org/ |
||||||
|
[Flecs]: https://flecs.dev/ |
@ -0,0 +1,31 @@ |
|||||||
|
const std = @import("std"); |
||||||
|
|
||||||
|
pub fn build(b: *std.Build) void { |
||||||
|
const target = b.standardTargetOptions(.{}); |
||||||
|
const optimize = b.standardOptimizeOption(.{}); |
||||||
|
|
||||||
|
const exe = b.addExecutable(.{ |
||||||
|
.name = "zig-bloxel-game", |
||||||
|
.root_source_file = .{ .path = "src/main.zig" }, |
||||||
|
.target = target, |
||||||
|
.optimize = optimize, |
||||||
|
}); |
||||||
|
b.installArtifact(exe); |
||||||
|
|
||||||
|
const run_cmd = b.addRunArtifact(exe); |
||||||
|
run_cmd.step.dependOn(b.getInstallStep()); |
||||||
|
if (b.args) |args| run_cmd.addArgs(args); |
||||||
|
|
||||||
|
const run_step = b.step("run", "Run the app"); |
||||||
|
run_step.dependOn(&run_cmd.step); |
||||||
|
|
||||||
|
const unit_tests = b.addTest(.{ |
||||||
|
.root_source_file = .{ .path = "src/main.zig" }, |
||||||
|
.target = target, |
||||||
|
.optimize = optimize, |
||||||
|
}); |
||||||
|
|
||||||
|
const run_unit_tests = b.addRunArtifact(unit_tests); |
||||||
|
const test_step = b.step("test", "Run unit tests"); |
||||||
|
test_step.dependOn(&run_unit_tests.step); |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
.{ |
||||||
|
.name = "zig-bloxel-game", |
||||||
|
.version = "0.0.0", |
||||||
|
|
||||||
|
.paths = .{ |
||||||
|
"src", |
||||||
|
"build.zig", |
||||||
|
"build.zig.zon", |
||||||
|
"README.md", |
||||||
|
}, |
||||||
|
} |
@ -0,0 +1,17 @@ |
|||||||
|
const std = @import("std"); |
||||||
|
|
||||||
|
pub fn main() !void { |
||||||
|
std.debug.print("All your {s} are belong to us.\n", .{"codebase"}); |
||||||
|
const stdout_file = std.io.getStdOut().writer(); |
||||||
|
var bw = std.io.bufferedWriter(stdout_file); |
||||||
|
const stdout = bw.writer(); |
||||||
|
try stdout.print("Run `zig build test` to run the tests.\n", .{}); |
||||||
|
try bw.flush(); |
||||||
|
} |
||||||
|
|
||||||
|
test "simple test" { |
||||||
|
var list = std.ArrayList(i32).init(std.testing.allocator); |
||||||
|
defer list.deinit(); |
||||||
|
try list.append(42); |
||||||
|
try std.testing.expectEqual(@as(i32, 42), list.pop()); |
||||||
|
} |
Loading…
Reference in new issue