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.GraphicsContext) anyerror!void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; { const file_access = try event_loop.open(.readonly, try sys.FileSystem.data.pathJoin(&.{"data", "ona.lua"})); defer _ = event_loop.close(file_access); const file_size = try file_access.size(event_loop); var buffer = try gpa.allocator().alloc(u8, file_size); if ((try event_loop.readFile(file_access, buffer)) != file_size) return error.ScriptLoadError; event_loop.log(buffer); } while (graphics.poll()) |_| { graphics.present(); } }