call raylib from zig
This commit is contained in:
parent
5814159185
commit
b201817d12
3 changed files with 38 additions and 22 deletions
|
@ -1,19 +1,21 @@
|
|||
const std = @import("std");
|
||||
const raylib = @cImport({
|
||||
@cInclude("raylib.h");
|
||||
});
|
||||
|
||||
pub fn main() !void {
|
||||
// Prints to stderr (it's a shortcut based on `std.io.getStdErr()`)
|
||||
std.debug.print("All your {s} are belong to us.\n", .{"codebase"});
|
||||
const screen_width = 800;
|
||||
const screen_height = 450;
|
||||
raylib.InitWindow(screen_width, screen_height, "raylib [core] example - basic window");
|
||||
raylib.SetTargetFPS(60);
|
||||
while (!raylib.WindowShouldClose()) {
|
||||
raylib.BeginDrawing();
|
||||
defer raylib.EndDrawing();
|
||||
|
||||
// stdout is for the actual output of your application, for example if you
|
||||
// are implementing gzip, then only the compressed bytes should be sent to
|
||||
// stdout, not any debugging messages.
|
||||
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!
|
||||
raylib.ClearBackground(raylib.RAYWHITE);
|
||||
raylib.DrawText("Congrats! You created your first window!", 190, 200, 20, raylib.LIGHTGRAY);
|
||||
}
|
||||
raylib.CloseWindow();
|
||||
}
|
||||
|
||||
test "simple test" {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue