prime31/zig-ecs

Basisc Groups don't have an `each` method

OAguinagalde opened this issue · 1 comments

The Readme states that...


The same example using a non-owning Group:

var group = reg.group(.{}, .{ Velocity, Position }, .{});
group.each(each);

fn each(e: struct { vel: *Velocity, pos: *Position }) void {
    e.pos.*.x += e.vel.x;
    e.pos.*.y += e.vel.y;
}

zig complains:

error: no member named 'each' in struct '.zig-ecs.ecs.groups.BasicGroup'

After looking for it I only managed to find the method each for OwningGroups.
Not that I know if there should or shouldn't be such method but just wanted to point out that the readme seems(?) wrong.

OwningGroup has the added benefit of contiguous array access for the data while non-owning groups have to go through the SparseSet to get to the data. Implementing each for a non-owning group doesnt really have any advantages so it wasnt added.