diff options
Diffstat (limited to 'src/main.zig')
-rw-r--r-- | src/main.zig | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/main.zig b/src/main.zig index 57ac609..4e93a8a 100644 --- a/src/main.zig +++ b/src/main.zig @@ -23,6 +23,7 @@ pub const c = @cImport({ const Loca = @import("loca").Loca; const Window = gf.Window; +const Scores = misc.Scores; const al = @import("zeal"); const allocator = std.heap.c_allocator; const configuration = @import("config.zig"); @@ -30,6 +31,8 @@ const free = std.c.free; const gf = @import("gfz"); const gl = @import("zgl"); const misc = @import("misc.zig"); +const loadScores = misc.loadScores; +const saveScores = misc.saveScores; const std = @import("std"); var game: *c.Game = undefined; @@ -63,7 +66,11 @@ pub fn main() !void { "Black Shades", .{}, .{}); try window.makeCurrent(); - game = c.makeGame(@bitCast(c.Config, config)).?; + game = c.makeGame(@bitCast(c.Config, config), + @bitCast(c.Scores, try loadScores(loca.user_data))).?; + defer saveScores(loca.user_data, @bitCast(Scores, c.getScores(game))) + catch unreachable; + try window.setSizeCallback(resizeWindow); try gf.swapInterval(@boolToInt(config.vsync)); c.initGl(game); |