const ext = @cImport({ @cInclude("SDL2/SDL.h"); }); const io = @import("./io.zig"); const stack = @import("./stack.zig"); const std = @import("std"); const sys = @import("./sys.zig"); /// /// Entry point. /// pub fn main() anyerror!void { return sys.runGraphics(anyerror, run); } fn run(event_loop: *sys.EventLoop, graphics: *sys.GraphicalContext) anyerror!void { var gpa = std.heap.GeneralPurposeAllocator(){}; { const file = event_loop.open(.readonly, sys.Path.get(.data, &.{"ona.lua"})); defer _ = event_loop.closeFile(file); const file_size = try file.size(event_loop); var buffer = try gpa.allocator().alloc(u8, file_size); if (try event_loop.readFile(buffer) != file_size) return error.ScriptLoadError; sys.log(buffer); } while (graphics.poll()) |_| { graphics.present(); } }