Compare commits
1 commit
911d13fc1c
...
e0657afa53
Author | SHA1 | Date | |
---|---|---|---|
|
e0657afa53 |
3
.gitmodules
vendored
3
.gitmodules
vendored
|
@ -1,3 +0,0 @@
|
||||||
[submodule "zig/3rd-party/raylib"]
|
|
||||||
path = zig/3rd-party/raylib
|
|
||||||
url = https://github.com/raysan5/raylib/
|
|
1
zig/3rd-party/raylib
vendored
1
zig/3rd-party/raylib
vendored
|
@ -1 +0,0 @@
|
||||||
Subproject commit bc15c19518968878b68bbfe8eac3fe4297f11770
|
|
|
@ -4,23 +4,33 @@ const std = @import("std");
|
||||||
// declaratively construct a build graph that will be executed by an external
|
// declaratively construct a build graph that will be executed by an external
|
||||||
// runner.
|
// runner.
|
||||||
pub fn build(b: *std.Build) void {
|
pub fn build(b: *std.Build) void {
|
||||||
|
// Standard target options allows the person running `zig build` to choose
|
||||||
|
// what target to build for. Here we do not override the defaults, which
|
||||||
|
// means any target is allowed, and the default is native. Other options
|
||||||
|
// for restricting supported target set are available.
|
||||||
const target = b.standardTargetOptions(.{});
|
const target = b.standardTargetOptions(.{});
|
||||||
|
|
||||||
|
// Standard optimization options allow the person running `zig build` to select
|
||||||
|
// between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall. Here we do not
|
||||||
|
// set a preferred release mode, allowing the user to decide how to optimize.
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
|
|
||||||
|
const raylib_dep = b.dependency("raylib", .{
|
||||||
|
// These are the arguments to the dependency. It expects a target and optimization level.
|
||||||
|
.target = target,
|
||||||
|
.optimize = optimize,
|
||||||
|
});
|
||||||
|
|
||||||
const exe = b.addExecutable(.{
|
const exe = b.addExecutable(.{
|
||||||
.name = "zig",
|
.name = "zig",
|
||||||
|
// In this case the main source file is merely a path, however, in more
|
||||||
|
// complicated build scripts, this could be a generated file.
|
||||||
.root_source_file = .{ .path = "src/main.zig" },
|
.root_source_file = .{ .path = "src/main.zig" },
|
||||||
.target = target,
|
.target = target,
|
||||||
.optimize = optimize,
|
.optimize = optimize,
|
||||||
});
|
});
|
||||||
|
|
||||||
// We cannot directly use modules since v4.5 is not compatible with zig
|
exe.addModule(raylib_dep.module("some_mod"));
|
||||||
// v0.11
|
|
||||||
const raylib_dep = b.anonymousDependency("3rd-party/raylib/", @import("3rd-party/raylib/build.zig"), .{
|
|
||||||
.target = target,
|
|
||||||
.optimize = optimize,
|
|
||||||
});
|
|
||||||
exe.linkLibrary(raylib_dep.artifact("raylib"));
|
|
||||||
|
|
||||||
// This declares intent for the executable to be installed into the
|
// This declares intent for the executable to be installed into the
|
||||||
// standard location when the user invokes the "install" step (the default
|
// standard location when the user invokes the "install" step (the default
|
||||||
|
|
10
zig/build.zig.zon
Normal file
10
zig/build.zig.zon
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
.{
|
||||||
|
.name = "fabapp",
|
||||||
|
.version = "0.1.0",
|
||||||
|
.dependencies = .{
|
||||||
|
.raylib = .{
|
||||||
|
.url = "https://github.com/raysan5/raylib/archive/refs/tags/4.5.0.tar.gz",
|
||||||
|
.hash = "1220ff8eeb8c51ed28ef7d1224ba2968e00e689774dd6316cb25347a44844dbf210f",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
16
zig/justfile
16
zig/justfile
|
@ -1,16 +0,0 @@
|
||||||
alias b := build
|
|
||||||
alias r := run
|
|
||||||
alias t := test
|
|
||||||
alias fmt := format
|
|
||||||
|
|
||||||
build:
|
|
||||||
zig build
|
|
||||||
|
|
||||||
run:
|
|
||||||
nixGL zig build run
|
|
||||||
|
|
||||||
test:
|
|
||||||
zig build test
|
|
||||||
|
|
||||||
format:
|
|
||||||
fd -e zig -X zig fmt {}
|
|
|
@ -1,21 +1,19 @@
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const raylib = @cImport({
|
|
||||||
@cInclude("raylib.h");
|
|
||||||
});
|
|
||||||
|
|
||||||
pub fn main() !void {
|
pub fn main() !void {
|
||||||
const screen_width = 800;
|
// Prints to stderr (it's a shortcut based on `std.io.getStdErr()`)
|
||||||
const screen_height = 450;
|
std.debug.print("All your {s} are belong to us.\n", .{"codebase"});
|
||||||
raylib.InitWindow(screen_width, screen_height, "raylib [core] example - basic window");
|
|
||||||
raylib.SetTargetFPS(60);
|
|
||||||
while (!raylib.WindowShouldClose()) {
|
|
||||||
raylib.BeginDrawing();
|
|
||||||
defer raylib.EndDrawing();
|
|
||||||
|
|
||||||
raylib.ClearBackground(raylib.RAYWHITE);
|
// stdout is for the actual output of your application, for example if you
|
||||||
raylib.DrawText("Congrats! You created your first window!", 190, 200, 20, raylib.LIGHTGRAY);
|
// are implementing gzip, then only the compressed bytes should be sent to
|
||||||
}
|
// stdout, not any debugging messages.
|
||||||
raylib.CloseWindow();
|
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(); // don't forget to flush!
|
||||||
}
|
}
|
||||||
|
|
||||||
test "simple test" {
|
test "simple test" {
|
||||||
|
|
Loading…
Reference in a new issue