aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNguyễn Gia Phong <mcsinyx@disroot.org>2021-10-29 18:01:11 +0700
committerNguyễn Gia Phong <mcsinyx@disroot.org>2021-10-29 18:01:11 +0700
commit6b871944a9b2df0f84cbe3682244e07cb415fe79 (patch)
treea6891662c58811e03cb63e4292bae60e9ae51489 /src
parent3a6ee8b91ede5fc9432643c33272e34d878d009c (diff)
downloadblackshades-6b871944a9b2df0f84cbe3682244e07cb415fe79.tar.gz
Update for gfz enums
Diffstat (limited to 'src')
-rw-r--r--src/main.zig21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/main.zig b/src/main.zig
index f019a61..241e557 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -22,8 +22,6 @@ pub const c = @cImport({
});
const Loca = @import("loca").Loca;
-const Key = gf.Key;
-const Window = gf.Window;
const Scores = misc.Scores;
const al = @import("zeal");
const allocator = std.heap.c_allocator;
@@ -38,21 +36,22 @@ const std = @import("std");
var game: *c.Game = undefined;
-fn resizeWindow(window: Window, width: c_int, height: c_int) void {
+fn resizeWindow(window: gf.Window, width: c_int, height: c_int) void {
c.resizeWindow(game, width, height);
}
-fn handleKey(window: Window, key: Key, scancode: c_int,
- action: c_int, mods: c_int) void {
- c.handleKey(game, @enumToInt(key), action, mods);
+fn handleKey(window: gf.Window, key: gf.Key, scancode: c_int,
+ action: gf.KeyAction, mods: gf.Mods) void {
+ c.handleKey(game, @enumToInt(key), @enumToInt(action), mods.toInt());
}
-fn look(window: Window, xpos: f64, ypos: f64) void {
+fn look(window: gf.Window, xpos: f64, ypos: f64) void {
c.look(game, xpos, ypos);
}
-fn click(window: Window, button: c_int, action: c_int, mods: c_int) void {
- c.click(game, button, action, mods);
+fn click(window: gf.Window, button: gf.MouseButton,
+ action: gf.MouseButton.Action, mods: gf.Mods) void {
+ c.click(game, @enumToInt(button), @enumToInt(action), mods.toInt());
}
pub fn main() !void {
@@ -63,8 +62,8 @@ pub fn main() !void {
try gf.init();
defer gf.deinit() catch unreachable;
- const window = try Window.create(config.width, config.height,
- "Black Shades", .{}, .{});
+ const window = try gf.Window.create(config.width, config.height,
+ "Black Shades", .{}, .{});
try window.makeCurrent();
game = c.makeGame(@bitCast(c.Config, config),