From 5c63afb96e18ec0d5bf7829c16480523201a5964 Mon Sep 17 00:00:00 2001 From: peterino2 Date: Fri, 10 Oct 2025 21:51:04 -0700 Subject: [PATCH] saving --- projects/sampleGame/externGame/externGame.zig | 27 +++++++++++++++ .../sampleGame/externGame/fpgame/fpgame.zig | 33 +++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 projects/sampleGame/externGame/fpgame/fpgame.zig diff --git a/projects/sampleGame/externGame/externGame.zig b/projects/sampleGame/externGame/externGame.zig index 2dbdd8d..0802213 100644 --- a/projects/sampleGame/externGame/externGame.zig +++ b/projects/sampleGame/externGame/externGame.zig @@ -239,6 +239,31 @@ pub const ExternGameObject = struct { core.engine_log("map loaded", .{}); } + pub fn fuckNazis(self: *@This()) !void { + const MultiJob = struct { + threadName: []const u8, + + pub fn func(ctx: @This(), job: *core.JobContext) void { + _ = job; + core.tracy.SetThreadName(self.threadName); + while (true) { + ctx.tick(); + } + } + + pub fn tick(ctx: @This()) void { + _ = ctx; + core.tracy.ZoneN(@src(), "MultiJob Tick"); + std.time.sleep(0.01); + } + }; + + for (0..12) |i| { + const name = try std.fmt.allocPrint(self.heap.c_allocator, "MultiJob{d}", .{i}); + try core.dispatchJob(MultiJob{ .threadName = name }); + } + } + pub fn create(allocator: std.mem.Allocator) !*@This() { const self = try Slack.create(allocator); self.* = .{ @@ -252,6 +277,8 @@ pub const ExternGameObject = struct { const args = try core.ParseArgs(ExternGameArgs); + try self.fuckNazis(); + if (args.asClient) { self.launchAsClient = args.clientTarget; self.clientIndex = args.clientIndex; diff --git a/projects/sampleGame/externGame/fpgame/fpgame.zig b/projects/sampleGame/externGame/fpgame/fpgame.zig new file mode 100644 index 0000000..511fd30 --- /dev/null +++ b/projects/sampleGame/externGame/fpgame/fpgame.zig @@ -0,0 +1,33 @@ +pub const Slack = core.SlackStruct(@This(), 1024); + +allocator: std.mem.Allocator = undefined, +entity: core.Entity = undefined, +camera: *extras.FpCamera = undefined, + +pub var NeonObjectTable: core.EngineObjectVTable = core.EngineObjectVTable.from(@This(), "extern.FpPlayer"); + +pub fn create(allocator: std.mem.Allocator) !*@This() { + const self = try Slack.create(allocator); + + self.* = .{ + .allocator = allocator, + .entity = try core.createEntity(), + .camera = try extras.FpCamera.create(allocator), + }; + + return self; +} + +pub fn objectReload(self: *@This()) void { + _ = self; +} + +pub fn destroy(self: *@This()) void { + self.camera.destroy(); + self.allocator.destroy(Slack.fromPtr(self)); +} + +const backlog = @import("backlog"); +const core = backlog.core; +const std = @import("std"); +const extras = @import("gameExtras");