Use default field values for Probe struct

main
copygirl 9 months ago
parent e0bdf5f182
commit 846b738bf5
  1. 4
      src/test/flecs/world.zig
  2. 28
      src/test/util.zig

@ -41,7 +41,7 @@ test "World_progress_w_0" {
const move_system = try world.system("move", move, c.EcsOnUpdate, "Position, Velocity"); const move_system = try world.system("move", move, c.EcsOnUpdate, "Position, Velocity");
var ctx = util.Probe.init(); var ctx = util.Probe{};
c.ecs_set_ctx(world.raw, &ctx, null); c.ecs_set_ctx(world.raw, &ctx, null);
e1.set(Position, .{ .x = 0, .y = 0 }); e1.set(Position, .{ .x = 0, .y = 0 });
@ -78,7 +78,7 @@ test "World_progress_w_t" {
const move_system = try world.system("move", move, c.EcsOnUpdate, "Position, Velocity"); const move_system = try world.system("move", move, c.EcsOnUpdate, "Position, Velocity");
var ctx = util.Probe.init(); var ctx = util.Probe{};
c.ecs_set_ctx(world.raw, &ctx, null); c.ecs_set_ctx(world.raw, &ctx, null);
e1.set(Position, .{ .x = 0, .y = 0 }); e1.set(Position, .{ .x = 0, .y = 0 });

@ -14,22 +14,18 @@ pub const MAX_ENTITIES = 256;
pub const MAX_INVOCATIONS = 1024; pub const MAX_INVOCATIONS = 1024;
pub const Probe = struct { pub const Probe = struct {
system: c.ecs_entity_t, system: c.ecs_entity_t = 0,
event: c.ecs_entity_t, event: c.ecs_entity_t = 0,
eventId: c.ecs_id_t, eventId: c.ecs_id_t = 0,
offset: usize, offset: usize = 0,
count: usize, count: usize = 0,
invoked: usize, invoked: usize = 0,
termCount: usize, termCount: usize = 0,
termIndex: usize, termIndex: usize = 0,
e: [MAX_ENTITIES]c.ecs_entity_t, e: [MAX_ENTITIES]c.ecs_entity_t = .{0} ** MAX_ENTITIES,
c: [MAX_SYS_COLUMNS][MAX_INVOCATIONS]c.ecs_entity_t, c: [MAX_SYS_COLUMNS][MAX_INVOCATIONS]c.ecs_entity_t = .{.{0} ** MAX_INVOCATIONS} ** MAX_SYS_COLUMNS,
s: [MAX_SYS_COLUMNS][MAX_INVOCATIONS]c.ecs_entity_t, s: [MAX_SYS_COLUMNS][MAX_INVOCATIONS]c.ecs_entity_t = .{.{0} ** MAX_INVOCATIONS} ** MAX_SYS_COLUMNS,
param: ?*anyopaque, param: ?*anyopaque = null,
pub fn init() Probe {
return std.mem.zeroes(Probe);
}
pub fn probeSystemWithContext(ctx: *Probe, it: Iter) !void { pub fn probeSystemWithContext(ctx: *Probe, it: Iter) !void {
ctx.param = it.raw.param; ctx.param = it.raw.param;

Loading…
Cancel
Save