fixed up toolbox.zig

This commit is contained in:
Peter Li 2025-11-01 15:25:49 -07:00
parent 60dfe0ae60
commit 054b41da95
3 changed files with 5 additions and 4 deletions

View File

@ -27,7 +27,7 @@ pub const PngContents = struct {
return pngContents; return pngContents;
} }
pub fn initFromFSCooked(fs: *core.FileSystem, allocator: std.mem.Allocator, path: []const u8) !@This() { pub fn initFromFSCooked(fs: *core.PackerFS, allocator: std.mem.Allocator, path: []const u8) !@This() {
const mapping = try fs.loadFile(path); const mapping = try fs.loadFile(path);
defer fs.unmap(mapping); defer fs.unmap(mapping);
@ -55,7 +55,7 @@ pub const PngContents = struct {
return buffer; return buffer;
} }
pub fn initFromFS(fs: *core.FileSystem, allocator: std.mem.Allocator, path: []const u8) !@This() { pub fn initFromFS(fs: *core.PackerFS, allocator: std.mem.Allocator, path: []const u8) !@This() {
// 1. check the fs to see if a cooked version of the file exists // 1. check the fs to see if a cooked version of the file exists
// 2. load that one if possible // 2. load that one if possible
// 3. otherwise, load the other one. // 3. otherwise, load the other one.

View File

@ -74,7 +74,7 @@ pub fn uploadCubeFromPaths(self: *@This(), name: core.Name, paths: []const []con
var textureSize: u32 = 0; var textureSize: u32 = 0;
for (paths) |path| { for (paths) |path| {
try cubeList.append(self.allocator, try core.png.PngContents.initFromFS(core.fs(), self.allocator, path)); try cubeList.append(self.allocator, try rend.png.PngContents.initFromFS(core.fs(), self.allocator, path));
const png = &cubeList.items[cubeList.items.len - 1]; const png = &cubeList.items[cubeList.items.len - 1];
const cmd = self.device.acquireGPUCommandBuffer(); const cmd = self.device.acquireGPUCommandBuffer();

View File

@ -55,7 +55,7 @@ pub fn create(allocator: std.mem.Allocator) !*@This() {
} }
pub fn setupCallbacks(self: *@This()) !void { pub fn setupCallbacks(self: *@This()) !void {
core.fs().watchPath("content/"); platform.watchPath("content/");
try core.fs().addAnyWatchCallback(fileChangedCallback, self); try core.fs().addAnyWatchCallback(fileChangedCallback, self);
} }
@ -161,4 +161,5 @@ const sys = api.sys;
const zgltf = core.zgltf; const zgltf = core.zgltf;
const assets = api.assets; const assets = api.assets;
const cook = assets.cook; const cook = assets.cook;
const platform = api.platform;
const extras = @import("gameExtras"); const extras = @import("gameExtras");