saving
This commit is contained in:
parent
d89915ee4e
commit
5c63afb96e
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
Loading…
Reference in New Issue