allocator: std.mem.Allocator, lastUpdateFrame: u64 = 0, arena: std.heap.ArenaAllocator, bodyIds: std.ArrayList(physics.BodyId), pub var NeonObjectTable = core.EngineObjectVTable.from(@This(), "extras.PhysicsObjectList"); pub fn create(allocator: std.mem.Allocator) !*@This() { const self = try allocator.create(@This()); self.* = .{ .allocator = allocator, .arena = std.heap.ArenaAllocator.init(allocator), .bodyIds = std.ArrayList(physics.BodyId).init(allocator), }; if (core.getEngineObject(igutils.TopBar)) |topbar| { topbar.addMenuObject(self, "Physis Objects") catch {}; } return self; } pub fn windowOpen(entry: *igutils.MenuEntry, dt: f64) void { _ = dt; const self: *@This() = @ptrCast(@alignCast(entry.ctx)); self.bodyIds.clearRetainingCapacity(); physics.context().system.getBodyIds(&self.bodyIds) catch return; if (ig.begin("Physics Objects", &entry.open, .{})) { ig.textf("total Physics Objects count: {d}", .{self.bodyIds.items.len}); for (self.bodyIds.items) |bodyId| { ig.textf("body Id: {any}", .{bodyId}); } } ig.end(); } pub fn destroy(self: *@This()) void { self.arena.deinit(); self.bodyIds.deinit(); self.allocator.destroy(self); } const std = @import("std"); const backlog = @import("Backlog"); const core = backlog.core; const rend = backlog.rend; const ig = backlog.imgui.api; const igutils = backlog.imgui.utils; const physics = backlog.physics;