commit cd334f1a842757f9d9c75b9f91a454ab3657bdc4 Author: Rokas Puzonas Date: Sat Feb 10 19:26:52 2024 +0200 initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4c82b07 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +zig-cache +zig-out diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..17cbea5 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "libs/raylib"] + path = libs/raylib + url = git@rpuzonas.com:rpuzonas/raylib-zig.git diff --git a/build.zig b/build.zig new file mode 100644 index 0000000..ee555da --- /dev/null +++ b/build.zig @@ -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); + +} diff --git a/libs/raylib b/libs/raylib new file mode 160000 index 0000000..97f5012 --- /dev/null +++ b/libs/raylib @@ -0,0 +1 @@ +Subproject commit 97f501240b3b23fa338ae589d484e914270f13eb diff --git a/src/main.zig b/src/main.zig new file mode 100644 index 0000000..2378d9b --- /dev/null +++ b/src/main.zig @@ -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); + } +}