Update build system to latest raylib

This commit is contained in:
Not-Nik 2022-03-18 16:57:15 +01:00
parent c83263a8a7
commit ba7b7c97f8
No known key found for this signature in database
GPG Key ID: 08BB71E672DB3BFD
5 changed files with 64 additions and 66 deletions

9
.gitignore vendored
View File

@ -2,10 +2,7 @@ zig-cache/
.idea/
Project/*
**/raylib.h
**/raymath.h
**/.DS_Store
**/CMakeLists.txt
**/cmake-build-debug
examples/**/**.c
raylib.h
raymath.h
libraylib.a
**/.DS_Store

View File

@ -7,7 +7,7 @@
const std = @import("std");
const Builder = std.build.Builder;
const raylib = @import("lib.zig").Pkg(".");
const raylib = @import("lib.zig");
const Program = struct {
name: []const u8,

View File

@ -59,8 +59,7 @@ pub fn main() anyerror!void
if ((touchPosition.x >= 0) and (touchPosition.y >= 0)) // Make sure point is not (-1,-1) as this means there is no touch for it
{
// Draw circle and touch index number
rl.DrawCircle(@floatToInt(c_int, touchPosition.x), @floatToInt(c_int, touchPosition.y), 34, rl.ORANGE);
//DrawCircleV(touchPosition, 34, ORANGE);
rl.DrawCircleV(touchPosition, 34, rl.ORANGE);
rl.DrawText(rl.FormatText("%d", i), @floatToInt(c_int, touchPosition.x) - 10, @floatToInt(c_int, touchPosition.y) - 70, 40, rl.BLACK);
}
}

34
lib.zig
View File

@ -1,12 +1,16 @@
const std = @import("std");
const Builder = std.build.Builder;
const LibExeObjStep = std.build.LibExeObjStep;
const rl = @import("raylib/src/build.zig").Pkg("raylib/src");
const rl = @import("raylib/src/build.zig");
pub fn Pkg(pkgdir: []const u8) type {
return struct {
var ran_git = false;
pub fn link(exe: *LibExeObjStep, system_lib: bool) void {
var ran_git = false;
const srcdir = getSrcDir();
fn getSrcDir() []const u8 {
return std.fs.path.dirname(@src().file) orelse ".";
}
pub fn link(exe: *LibExeObjStep, system_lib: bool) void {
if (system_lib) {
exe.linkSystemLibrary("raylib");
return;
@ -48,15 +52,13 @@ pub fn Pkg(pkgdir: []const u8) type {
exe.linkSystemLibrary("X11");
},
}
}
pub fn addAsPackage(name: []const u8, to: *LibExeObjStep) void {
to.addPackagePath(name, pkgdir ++ "/lib/raylib-zig.zig");
}
pub const math = struct {
pub fn addAsPackage(name: []const u8, to: *LibExeObjStep) void {
to.addPackagePath(name, pkgdir ++ "/lib/raylib-zig-math.zig");
}
};
};
}
pub fn addAsPackage(name: []const u8, to: *LibExeObjStep) void {
to.addPackagePath(name, srcdir ++ "/lib/raylib-zig.zig");
}
pub const math = struct {
pub fn addAsPackage(name: []const u8, to: *LibExeObjStep) void {
to.addPackagePath(name, srcdir ++ "/lib/raylib-zig-math.zig");
}
};

2
raylib

@ -1 +1 @@
Subproject commit a6aa5a1e4c34e7d8dfbede6d17ee40f7648265bb
Subproject commit 9ecbc465a934fdde9e3d69a709370a370bf193a0