aboutsummaryrefslogtreecommitdiff
path: root/src/main.zig
diff options
context:
space:
mode:
authorNguyễn Gia Phong <mcsinyx@disroot.org>2021-09-08 15:46:39 +0700
committerNguyễn Gia Phong <mcsinyx@disroot.org>2021-09-08 15:52:39 +0700
commitda79599ad5201f4eebd3edaabbe4b33498de448e (patch)
tree4f026ad0bb2ab643baadf057d8f391dbc4a9568f /src/main.zig
parent67cf9f61e91462eaf8e8caeaa7d0d7d3d9d1f711 (diff)
downloadblackshades-da79599ad5201f4eebd3edaabbe4b33498de448e.tar.gz
Move configuration parsing to Zig2.1.0
The config file is now read from configuration directories instead of pwd.
Diffstat (limited to 'src/main.zig')
-rw-r--r--src/main.zig20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/main.zig b/src/main.zig
index 34e3844..baca0e0 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -16,14 +16,24 @@
// You should have received a copy of the GNU General Public License
// along with Black Shades. If not, see <https://www.gnu.org/licenses/>.
-const legacy = @cImport({ @cInclude("Game.h"); });
-const al = @import("zeal");
+const Loca = @import("loca").Loca;
+const allocator = @import("std").heap.c_allocator;
+const legacy = @cImport(@cInclude("Game.h"));
+const configuration = @import("config.zig");
+const zeal = @import("zeal");
pub fn main() !void {
- try al.init(null);
- defer al.deinit() catch unreachable;
+ const loca = try Loca.init(allocator, .{});
+ defer loca.deinit();
+ const config = try configuration.parse(allocator, loca.user_config);
- const game = legacy.makeGame();
+ const device = try zeal.Device.init(null);
+ defer device.deinit() catch unreachable;
+ const context = try zeal.Context.init(device, &.{ });
+ defer context.deinit() catch unreachable;
+ try zeal.useContext(context);
+
+ const game = legacy.makeGame(@bitCast(legacy.Config, config));
legacy.initGl(game);
legacy.initGame(game);
defer legacy.closeGame(game);