master
menduz 1 year ago
parent 55f7813640
commit 531ae84819

@ -30,12 +30,12 @@ pub fn build(b: *Builder) void {
.optimize = optimize, .optimize = optimize,
}); });
// exe.setOutputDir(std.fs.path.join(b.allocator, &[_][]const u8{ b.cache_root, "bin" }) catch unreachable); // exe.setOutputDir(std.fs.path.join(b.allocator, &[_][]const u8{ b.cache_root, "bin" }) catch unreachable);
exe.output_dirname_source = .{ .path = std.fs.path.join(b.allocator, &[_][]const u8{ b.cache_root.path.?, "bin" }) catch unreachable, .step = &exe.step }; // exe.output_dirname_source = .{ .path = std.fs.path.join(b.allocator, &[_][]const u8{ b.cache_root.path.?, "bin" }) catch unreachable, .step = &exe.step };
exe.addModule("ecs", ecs_module); exe.addModule("ecs", ecs_module);
exe.linkLibC(); exe.linkLibC();
const docs = exe; const docs = exe;
docs.emit_docs = .emit; // docs.emit_docs = .emit;
const doc = b.step(b.fmt("{s}-docs", .{name}), "Generate documentation"); const doc = b.step(b.fmt("{s}-docs", .{name}), "Generate documentation");
doc.dependOn(&docs.step); doc.dependOn(&docs.step);

@ -38,7 +38,7 @@ fn iterateView(reg: *ecs.Registry) void {
var view = reg.view(.{ Velocity, Position }, .{}); var view = reg.view(.{ Velocity, Position }, .{});
var timer = std.time.Timer.start() catch unreachable; var timer = std.time.Timer.start() catch unreachable;
var iter = view.iterator(); var iter = view.entityIterator();
while (iter.next()) |entity| { while (iter.next()) |entity| {
var pos = view.get(Position, entity); var pos = view.get(Position, entity);
const vel = view.getConst(Velocity, entity); const vel = view.getConst(Velocity, entity);

@ -571,7 +571,7 @@ pub const Registry = struct {
// pre-fill the GroupData with any existing entitites that match // pre-fill the GroupData with any existing entitites that match
if (owned.len == 0) { if (owned.len == 0) {
var view_instance = self.view(owned ++ includes, excludes); var view_instance = self.view(owned ++ includes, excludes);
var view_iter = view_instance.iterator(); var view_iter = view_instance.entityIterator();
while (view_iter.next()) |entity| { while (view_iter.next()) |entity| {
new_group_data.entity_set.add(entity); new_group_data.entity_set.add(entity);
} }

@ -238,7 +238,7 @@ test "basic multi view" {
var view = reg.view(.{ i32, u32 }, .{}); var view = reg.view(.{ i32, u32 }, .{});
var iterated_entities: usize = 0; var iterated_entities: usize = 0;
var iter = view.iterator(); var iter = view.entityIterator();
while (iter.next()) |_| { while (iter.next()) |_| {
iterated_entities += 1; iterated_entities += 1;
} }
@ -276,7 +276,7 @@ test "basic multi view with excludes" {
var view = reg.view(.{ i32, u32 }, .{u8}); var view = reg.view(.{ i32, u32 }, .{u8});
var iterated_entities: usize = 0; var iterated_entities: usize = 0;
var iter = view.iterator(); var iter = view.entityIterator();
while (iter.next()) |_| { while (iter.next()) |_| {
iterated_entities += 1; iterated_entities += 1;
} }

Loading…
Cancel
Save