From 5b67fc2f78656ee9fac88d83723636fff3a13f6f Mon Sep 17 00:00:00 2001 From: Tony Bark Date: Mon, 6 May 2024 12:44:00 -0400 Subject: [PATCH] Created core.h file The core.h file references the required proprietary formas, including .iff and .far. However, the C files themselves still need to be accounted for in build.zig. --- build.zig | 4 +--- library/formats/core.h | 7 +++++++ src/main.zig | 18 ++++++++++++------ 3 files changed, 20 insertions(+), 9 deletions(-) create mode 100644 library/formats/core.h diff --git a/build.zig b/build.zig index 0a86b4c..64f5d6c 100644 --- a/build.zig +++ b/build.zig @@ -25,9 +25,7 @@ pub fn build(b: *std.Build) void { // C headers exe.linkLibC(); exe.linkLibCpp(); - exe.addIncludePath(.{ .path = "./library/formats" }); - exe.addIncludePath(.{ .path = "./library/libvitaboy" }); - exe.addIncludePath(.{ .path = "./tools" }); + exe.addIncludePath(.{ .path = "./library" }); // Modules const raylib_dep = b.dependency("raylib-zig", .{ diff --git a/library/formats/core.h b/library/formats/core.h new file mode 100644 index 0000000..0d8ce2a --- /dev/null +++ b/library/formats/core.h @@ -0,0 +1,7 @@ +#include "iff/iff.h" +#include "iff/iffparser.h" +#include "far/far.h" +#include "far/config.h" +#include "xa/read_xa.h" +#include "utk/read_utk.h" +#include "xa/read_xa.h" \ No newline at end of file diff --git a/src/main.zig b/src/main.zig index 1535843..ec77b74 100644 --- a/src/main.zig +++ b/src/main.zig @@ -1,11 +1,15 @@ const std = @import("std"); const rl = @import("raylib"); const world = @import("world.zig"); +const core = @cImport({ + @cInclude("./core.h"); +}); const GameScreen = enum { login, cas, - world, + map, + lot, }; // Still in the proof of concept phase, don't mind the mess @@ -27,12 +31,13 @@ pub fn main() anyerror!void { .projection = rl.CameraProjection.camera_perspective, }; + const floorLevel = rl.Vector3.init(0.0, 0.0, 0.0); + // const planePosition = rl.Vector3.init(0.0, 0.0, 0.0); // var textBox = rl.Rectangle.init(screen_width / 2.0 - 100, 180, 50); // var mouseOnText = false; // var letterCount = 0; - rl.setTargetFPS(60); // Media must be loaded after window init @@ -58,8 +63,10 @@ pub fn main() anyerror!void { }, // .cas => {}, - .world => { + .map => {}, + .lot => { camera.update(rl.CameraMode.camera_third_person); + try world.load_floors("resources/empty_lot_mysim.json"); }, } // ------------------ @@ -81,14 +88,13 @@ pub fn main() anyerror!void { // Skip this for now .cas => {}, // "World" (i.e. lot view) - .world => { + .lot => { rl.clearBackground(rl.Color.ray_white); camera.begin(); defer camera.end(); - // rl.drawPlane(planePosition, rl.Vector2.init(2, 2), rl.Color.green); - try world.draw_floors("resources/empty_lot_mysim.json"); + rl.drawPlane(floorLevel, rl.Vector2.init(2, 2), rl.Color.green); rl.drawGrid(64, 1.0); }, }