mirror of https://git.sr.ht/~kikoodx/kble
37 lines
932 B
Zig
37 lines
932 B
Zig
const std = @import("std");
|
|
const assert = std.debug.assert;
|
|
const Level = @import("level.zig").Level;
|
|
const ray = @cImport({
|
|
@cInclude("raylib.h");
|
|
});
|
|
|
|
pub fn main() !void {
|
|
// Create allocator
|
|
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
|
|
defer {
|
|
const leaked = gpa.deinit();
|
|
if (leaked) assert(false); //raise error
|
|
}
|
|
const allocator = &gpa.allocator;
|
|
|
|
// Create window
|
|
ray.SetConfigFlags(ray.FLAG_WINDOW_RESIZABLE);
|
|
ray.InitWindow(640, 480, "KBLE");
|
|
defer ray.CloseWindow();
|
|
|
|
// Limit FPS for performance
|
|
ray.SetTargetFPS(60);
|
|
|
|
// Create level
|
|
var level: Level = try Level.init(allocator, 128, 128);
|
|
defer level.deinit(allocator);
|
|
|
|
while (!ray.WindowShouldClose()) {
|
|
ray.BeginDrawing();
|
|
defer ray.EndDrawing();
|
|
|
|
ray.ClearBackground(ray.RAYWHITE);
|
|
ray.DrawText("Hellowo!", 190, 200, 20, ray.LIGHTGRAY);
|
|
}
|
|
}
|