-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Synced with raylib latest, and fixed build #41
base: main
Are you sure you want to change the base?
Conversation
now it does |
are you sure that #40 is fixed with that? because it seems that I still get it |
just do:
|
I guess this PR should also change the README to avoid confusions then. Btw, I keep seeing the same error as #40 even when using your fork, zig 0.11.0 and this particular snippet. Maybe I'm doing something wrong. |
Changing:
fixes it for me (I'm using latest zig) It seems like even the official raylib repo is having to use some workarounds to deal with these API breakages (see the |
Tested with latest zig 0.12.0, working as expected |
Tried it and i still get:
|
Thank you @ProIcons so much for the PR. I finally able to build with Zig 0.12!
const std = @import("std");
const raylib = @import("raylib");
pub fn main() !void {
raylib.SetConfigFlags(raylib.ConfigFlags{ .FLAG_WINDOW_RESIZABLE = true });
raylib.InitWindow(800, 800, "hello world!");
raylib.SetTargetFPS(60);
defer raylib.CloseWindow();
while (!raylib.WindowShouldClose()) {
raylib.BeginDrawing();
defer raylib.EndDrawing();
raylib.ClearBackground(raylib.BLACK);
raylib.DrawFPS(10, 10);
raylib.DrawText("hello world!", 100, 100, 20, raylib.YELLOW);
}
} Edit const raylib = @import("raylib/build.zig");
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const lib = b.addStaticLibrary(.{
.name = "rayray",
.root_source_file = b.path("src/root.zig"),
.target = target,
.optimize = optimize,
});
b.installArtifact(lib);
const exe = b.addExecutable(.{
.name = "rayray",
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
});
raylib.addTo(b, exe, target.query, 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 lib_unit_tests = b.addTest(.{
.root_source_file = b.path("src/root.zig"),
.target = target,
.optimize = optimize,
});
const run_lib_unit_tests = b.addRunArtifact(lib_unit_tests);
const exe_unit_tests = b.addTest(.{
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
});
const run_exe_unit_tests = b.addRunArtifact(exe_unit_tests);
const test_step = b.step("test", "Run unit tests");
test_step.dependOn(&run_lib_unit_tests.step);
test_step.dependOn(&run_exe_unit_tests.step);
}
I'm on Arch Linux, Zig 0.12. |
It relies on: raysan5/raylib#3891
Fixes: #40 #39 #37
It doesn't however fix the parsing, which in the end might cause crashes if raylib is changed significantly.