diff options
Diffstat (limited to 'src/main.zig')
-rw-r--r-- | src/main.zig | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/src/main.zig b/src/main.zig index baca0e0..8552e10 100644 --- a/src/main.zig +++ b/src/main.zig @@ -18,24 +18,41 @@ const Loca = @import("loca").Loca; const allocator = @import("std").heap.c_allocator; +const gf = @import("gfz"); const legacy = @cImport(@cInclude("Game.h")); const configuration = @import("config.zig"); -const zeal = @import("zeal"); +const al = @import("zeal"); +const gl = @import("zgl"); pub fn main() !void { const loca = try Loca.init(allocator, .{}); defer loca.deinit(); const config = try configuration.parse(allocator, loca.user_config); + const game = legacy.makeGame(@bitCast(legacy.Config, config)); + + try gf.init(); + defer gf.deinit() catch unreachable; + const window = try gf.Window.create(config.width, config.height, + "Black Shades", .{}, .{}); + try window.makeCurrent(); + try window.setInputMode(.sticky_keys, true); + if (config.menu) { + try window.setInputMode(.sticky_mouse_buttons, true); + try window.setCursorMode(.hidden); + } + legacy.initGl(game); - const device = try zeal.Device.init(null); + const device = try al.Device.init(null); defer device.deinit() catch unreachable; - const context = try zeal.Context.init(device, &.{ }); + const context = try al.Context.init(device, &.{}); defer context.deinit() catch unreachable; - try zeal.useContext(context); + try al.useContext(context); - const game = legacy.makeGame(@bitCast(legacy.Config, config)); - legacy.initGl(game); legacy.initGame(game); defer legacy.closeGame(game); - legacy.eventLoop(game); + while (!try window.shouldClose()) { + legacy.eventLoop(game); + try window.swapBuffers(); + try gf.pollEvents(); + } } |