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.
This commit is contained in:
Tony Bark 2024-05-06 12:44:00 -04:00
parent c0cc46bd9e
commit 5b67fc2f78
3 changed files with 20 additions and 9 deletions

View file

@ -25,9 +25,7 @@ pub fn build(b: *std.Build) void {
// C headers // C headers
exe.linkLibC(); exe.linkLibC();
exe.linkLibCpp(); exe.linkLibCpp();
exe.addIncludePath(.{ .path = "./library/formats" }); exe.addIncludePath(.{ .path = "./library" });
exe.addIncludePath(.{ .path = "./library/libvitaboy" });
exe.addIncludePath(.{ .path = "./tools" });
// Modules // Modules
const raylib_dep = b.dependency("raylib-zig", .{ const raylib_dep = b.dependency("raylib-zig", .{

7
library/formats/core.h Normal file
View file

@ -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"

View file

@ -1,11 +1,15 @@
const std = @import("std"); const std = @import("std");
const rl = @import("raylib"); const rl = @import("raylib");
const world = @import("world.zig"); const world = @import("world.zig");
const core = @cImport({
@cInclude("./core.h");
});
const GameScreen = enum { const GameScreen = enum {
login, login,
cas, cas,
world, map,
lot,
}; };
// Still in the proof of concept phase, don't mind the mess // 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, .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); // const planePosition = rl.Vector3.init(0.0, 0.0, 0.0);
// var textBox = rl.Rectangle.init(screen_width / 2.0 - 100, 180, 50); // var textBox = rl.Rectangle.init(screen_width / 2.0 - 100, 180, 50);
// var mouseOnText = false; // var mouseOnText = false;
// var letterCount = 0; // var letterCount = 0;
rl.setTargetFPS(60); rl.setTargetFPS(60);
// Media must be loaded after window init // Media must be loaded after window init
@ -58,8 +63,10 @@ pub fn main() anyerror!void {
}, },
// //
.cas => {}, .cas => {},
.world => { .map => {},
.lot => {
camera.update(rl.CameraMode.camera_third_person); 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 // Skip this for now
.cas => {}, .cas => {},
// "World" (i.e. lot view) // "World" (i.e. lot view)
.world => { .lot => {
rl.clearBackground(rl.Color.ray_white); rl.clearBackground(rl.Color.ray_white);
camera.begin(); camera.begin();
defer camera.end(); defer camera.end();
// rl.drawPlane(planePosition, rl.Vector2.init(2, 2), rl.Color.green); rl.drawPlane(floorLevel, rl.Vector2.init(2, 2), rl.Color.green);
try world.draw_floors("resources/empty_lot_mysim.json");
rl.drawGrid(64, 1.0); rl.drawGrid(64, 1.0);
}, },
} }