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");
var ctx = util.Probe.init();
var ctx = util.Probe{};
c.ecs_set_ctx(world.raw, &ctx, null);
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");
var ctx = util.Probe.init();
var ctx = util.Probe{};
c.ecs_set_ctx(world.raw, &ctx, null);
e1.set(Position, .{ .x = 0, .y = 0 });

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

Loading…
Cancel
Save