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 nosuspend await async sys.runGraphics(anyerror, run); } test { _ = io; _ = stack; _ = std; _ = sys; } fn run(app: *sys.AppContext, graphics: *sys.GraphicsContext) anyerror!void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa.deinit(); { var file_access = try (try app.data().joinedPath(&.{"ona.lua"})).open(.readonly); defer file_access.close(); const file_size = try file_access.queryLength(); const allocator = gpa.allocator(); const buffer = try allocator.alloc(u8, file_size); defer allocator.free(buffer); if ((try file_access.read(buffer)) != file_size) return error.ScriptLoadFailure; sys.Log.debug.write(buffer); } while (graphics.poll()) |_| { graphics.present(); } }