From 9420ca82fe6e72d82868e77a3bb2a7649f1bfd55 Mon Sep 17 00:00:00 2001 From: dusk Date: Sun, 1 Oct 2023 15:28:18 +0200 Subject: [PATCH] Temporal changes --- src/Config/controls.zig | 11 +++++++++++ src/Game/Score.zig | 1 + src/input.zig | 16 ++++++++++++++++ src/main.zig | 5 ----- 4 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 src/Config/controls.zig create mode 100644 src/Game/Score.zig diff --git a/src/Config/controls.zig b/src/Config/controls.zig new file mode 100644 index 0000000..19b6789 --- /dev/null +++ b/src/Config/controls.zig @@ -0,0 +1,11 @@ +@import("../input.zig"); + +fn loadControls() void { + +} + +fn createControls() void { + +} + +pub const controls = config.init("coso.ini")I diff --git a/src/Game/Score.zig b/src/Game/Score.zig new file mode 100644 index 0000000..359fefe --- /dev/null +++ b/src/Game/Score.zig @@ -0,0 +1 @@ +const Score = @Type(u64); diff --git a/src/input.zig b/src/input.zig index 4490a6b..75edd07 100644 --- a/src/input.zig +++ b/src/input.zig @@ -1,4 +1,6 @@ const rl = @import("raylib.zig"); +const std = @import("std"); +const config = @import("Config/config.zig"); pub const Input = struct { name: []const u8, @@ -24,6 +26,20 @@ fn init(comptime name: []const u8, comptime key_code: []const u8) Input { }; } +pub fn loadConfig() void { + var configIterator = config.getConfigIterator("input.ini") catch { + // Error opening config + std.debug.print("Cannot load input.ini configuration file, using default keybindings\n"); + return; + }; + + // while (configIterator.next()) |option| { + + // } + configIterator.deinit(); + +} + pub var menu_right = init("Menu Right", "RIGHT"); pub var menu_left = init("Menu Left", "LEFT"); pub var menu_down = init("Menu Down", "DOWN"); diff --git a/src/main.zig b/src/main.zig index b285b4b..0f197c7 100644 --- a/src/main.zig +++ b/src/main.zig @@ -11,11 +11,6 @@ const State = @import("flow.zig").State; pub fn main() !void { - var configIterator = config.getConfigIterator("test") catch unreachable; - while (configIterator.next()) |option| { - std.debug.print("Key: {s}, Option: {s}\n", .{option.key, option.value}); - } - configIterator.deinit(); var renderer = try Renderer.init();