aboutsummaryrefslogtreecommitdiff
path: root/src/main.zig
diff options
context:
space:
mode:
authorNguyễn Gia Phong <mcsinyx@disroot.org>2021-10-20 15:01:21 +0700
committerNguyễn Gia Phong <mcsinyx@disroot.org>2021-10-20 15:03:25 +0700
commit446f5c5fd7cd977f096cd2d6256d829a765467c9 (patch)
treeb4ee3ca3c9fb70692fd41ef527b2d23b0fd742aa /src/main.zig
parent8b4d97bd9bc7f522eb3b731aa2cc8b3fda714139 (diff)
downloadblackshades-446f5c5fd7cd977f096cd2d6256d829a765467c9.tar.gz
Use higher level callback for glfw
Diffstat (limited to 'src/main.zig')
-rw-r--r--src/main.zig17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/main.zig b/src/main.zig
index 11775ec..57ac609 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -22,6 +22,7 @@ pub const c = @cImport({
});
const Loca = @import("loca").Loca;
+const Window = gf.Window;
const al = @import("zeal");
const allocator = std.heap.c_allocator;
const configuration = @import("config.zig");
@@ -33,22 +34,20 @@ const std = @import("std");
var game: *c.Game = undefined;
-fn resizeWindow(window: ?*gf.Window.Impl,
- width: c_int, height: c_int) callconv(.C) void {
+fn resizeWindow(window: Window, width: c_int, height: c_int) void {
c.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 {
+fn handleKey(window: Window, key: c_int, scancode: c_int,
+ action: c_int, mods: c_int) void {
c.handleKey(game, key, action, mods);
}
-fn look(window: ?*gf.Window.Impl, xpos: f64, ypos: f64) callconv(.C) void {
+fn look(window: Window, xpos: f64, ypos: f64) void {
c.look(game, xpos, ypos);
}
-fn click(window: ?*gf.Window.Impl, button: c_int,
- action: c_int, mods: c_int) callconv(.C) void {
+fn click(window: Window, button: c_int, action: c_int, mods: c_int) void {
c.click(game, button, action, mods);
}
@@ -60,8 +59,8 @@ pub fn main() !void {
try gf.init();
defer gf.deinit() catch unreachable;
- const window = try gf.Window.create(config.width, config.height,
- "Black Shades", .{}, .{});
+ const window = try Window.create(config.width, config.height,
+ "Black Shades", .{}, .{});
try window.makeCurrent();
game = c.makeGame(@bitCast(c.Config, config)).?;