|
|
@ -33,11 +33,11 @@ pub fn Iter(comptime ctx: anytype) type { |
|
|
|
return (self.raw.flags & c.EcsIterIsValid) != 0; |
|
|
|
return (self.raw.flags & c.EcsIterIsValid) != 0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
pub fn getCount(self: Self) usize { |
|
|
|
pub fn count(self: Self) usize { |
|
|
|
return @intCast(self.raw.count); |
|
|
|
return @intCast(self.raw.count); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
pub fn getDeltaTime(self: Self) f32 { |
|
|
|
pub fn deltaTime(self: Self) f32 { |
|
|
|
return self.raw.delta_time; |
|
|
|
return self.raw.delta_time; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -45,8 +45,8 @@ pub fn Iter(comptime ctx: anytype) type { |
|
|
|
const raw_ptr = c.ecs_field_w_size(self.raw, @sizeOf(T), @intCast(index)); |
|
|
|
const raw_ptr = c.ecs_field_w_size(self.raw, @sizeOf(T), @intCast(index)); |
|
|
|
var typed_ptr: [*]T = @alignCast(@ptrCast(raw_ptr)); |
|
|
|
var typed_ptr: [*]T = @alignCast(@ptrCast(raw_ptr)); |
|
|
|
const is_self = c.ecs_field_is_self(self.raw, @intCast(index)); |
|
|
|
const is_self = c.ecs_field_is_self(self.raw, @intCast(index)); |
|
|
|
const count = if (is_self) self.getCount() else 1; |
|
|
|
const count_ = if (is_self) self.count() else 1; |
|
|
|
return typed_ptr[0..count]; |
|
|
|
return typed_ptr[0..count_]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
pub fn fieldId(self: Self, index: usize) Id { |
|
|
|
pub fn fieldId(self: Self, index: usize) Id { |
|
|
|