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.zig27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/main.zig b/src/main.zig
index d7a1da1..d40f012 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -19,37 +19,40 @@
 const Loca = @import("loca").Loca;
 const al = @import("zeal");
 const allocator = @import("std").heap.c_allocator;
+const c = @cImport({
+    @cInclude("Game.h");
+    @cInclude("Constants.h");
+});
 const configuration = @import("config.zig");
 const gf = @import("gfz");
 const gl = @import("zgl");
-const legacy = @cImport(@cInclude("Game.h"));
 const misc = @import("misc.zig");
 
-var game: *legacy.Game = undefined;
+var game: *c.Game = undefined;
 
 fn resizeWindow(window: ?*gf.Window.Impl,
                 width: c_int, height: c_int) callconv(.C) void {
-    legacy.resizeWindow(game, width, height);
+    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 {
-    legacy.handleKey(game, key, action, mods);
+    c.handleKey(game, key, action, mods);
 }
 
 fn look(window: ?*gf.Window.Impl, xpos: f64, ypos: f64) callconv(.C) void {
-    legacy.look(game, xpos, ypos);
+    c.look(game, xpos, ypos);
 }
 
 fn click(window: ?*gf.Window.Impl, button: c_int,
          action: c_int, mods: c_int) callconv(.C) void {
-    legacy.click(game, button, action, mods);
+    c.click(game, button, action, mods);
 }
 
 pub fn main() !void {
     const loca = try Loca.init(allocator, .{});
     defer loca.deinit();
-    const config = try configuration.parse(allocator, loca.user_config);
+    const config = try configuration.parse(loca.user_config);
 
     try gf.init();
     defer gf.deinit() catch unreachable;
@@ -57,10 +60,10 @@ pub fn main() !void {
                                         "Black Shades", .{}, .{});
     try window.makeCurrent();
 
-    game = legacy.makeGame(@bitCast(legacy.Config, config)).?;
+    game = c.makeGame(@bitCast(c.Config, config)).?;
     try window.setSizeCallback(resizeWindow);
     try gf.swapInterval(@boolToInt(config.vsync));
-    legacy.initGl(game);
+    c.initGl(game);
 
     if (try gf.rawMouseMotionSupported())
         try window.setInputMode(.raw_mouse_motion, true);
@@ -76,10 +79,10 @@ pub fn main() !void {
     defer context.deinit() catch unreachable;
     try context.makeCurrent();
 
-    legacy.initGame(game);
-    defer legacy.closeGame(game);
+    c.initGame(game);
+    defer c.closeGame(game);
     while (!try window.shouldClose()) {
-        legacy.eventLoop(game);
+        c.eventLoop(game);
         try window.swapBuffers();
         try gf.pollEvents();
     }