summary refs log tree commit diff
path: root/src/main.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.zig')
-rw-r--r--src/main.zig15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/main.zig b/src/main.zig
index 976fdd6..2364b8e 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -26,10 +26,14 @@ const gl = @import("zgl");
 
 var game: *legacy.Game = undefined;
 
-fn keyCallback(window: ?@typeInfo(gf.Window).Struct.fields[0].field_type,
-               key: c_int, scancode: c_int,
-               action: c_int, mods: c_int) callconv(.C) void {
-    legacy.keyCallback(game, key, action, mods);
+fn resizeWindow(window: ?*gf.Window.Impl,
+                width: c_int, height: c_int) callconv(.C) void {
+    legacy.resizeWindow(game, width, height);
+}
+
+fn handleKey(window: ?*gf.Window.Impl, key: c_int, scancode: c_int,
+             action: c_int, mods: c_int) callconv(.C) void {
+    legacy.handleKey(game, key, action, mods);
 }
 
 pub fn main() !void {
@@ -43,6 +47,7 @@ pub fn main() !void {
     const window = try gf.Window.create(config.width, config.height,
                                         "Black Shades", .{}, .{});
     try window.makeCurrent();
+    try window.setSizeCallback(resizeWindow);
     legacy.initGl(game);
 
     try window.setCursorMode(.disabled);
@@ -50,7 +55,7 @@ pub fn main() !void {
         try window.setInputMode(.raw_mouse_motion, true);
     try window.setInputMode(.sticky_mouse_buttons, true);
     try window.setInputMode(.sticky_keys, true);
-    try window.setKeyCallback(keyCallback);
+    try window.setKeyCallback(handleKey);
 
     const device = try al.Device.init(null);
     defer device.deinit() catch unreachable;