initial commit

This commit is contained in:
Rokas Puzonas 2024-02-10 19:26:52 +02:00
commit cd334f1a84
5 changed files with 57 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
zig-cache
zig-out

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "libs/raylib"]
path = libs/raylib
url = git@rpuzonas.com:rpuzonas/raylib-zig.git

32
build.zig Normal file
View File

@ -0,0 +1,32 @@
const std = @import("std");
const raylib = @import("libs/raylib/build.zig");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const exe = b.addExecutable(.{
.name = "step-kill",
.root_source_file = .{ .path = "src/main.zig" },
.target = target,
.optimize = optimize,
});
raylib.addTo(b, exe, target, optimize, .{});
const git_submodule_run = b.addSystemCommand(&.{"git", "submodule", "update", "--init", "--recursive"});
exe.step.dependOn(&git_submodule_run.step);
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);
}

1
libs/raylib Submodule

@ -0,0 +1 @@
Subproject commit 97f501240b3b23fa338ae589d484e914270f13eb

19
src/main.zig Normal file
View File

@ -0,0 +1,19 @@
const rl = @import("raylib");
pub fn main() void {
rl.SetConfigFlags(rl.ConfigFlags{ .FLAG_WINDOW_RESIZABLE = true });
rl.InitWindow(800, 800, "hello world!");
rl.SetTargetFPS(60);
defer rl.CloseWindow();
while (!rl.WindowShouldClose()) {
rl.BeginDrawing();
defer rl.EndDrawing();
rl.ClearBackground(rl.BLACK);
rl.DrawFPS(10, 10);
rl.DrawText("hello world!", 100, 100, 20, rl.YELLOW);
}
}