|
|
@ -85,7 +85,7 @@ pub const OwningGroup = struct {
|
|
|
|
|
|
|
|
|
|
|
|
var component_ptrs: [component_info.fields.len][*]u8 = undefined;
|
|
|
|
var component_ptrs: [component_info.fields.len][*]u8 = undefined;
|
|
|
|
inline for (component_info.fields) |field, i| {
|
|
|
|
inline for (component_info.fields) |field, i| {
|
|
|
|
const storage = group.registry.assure(field.field_type.Child);
|
|
|
|
const storage = group.registry.assure(@typeInfo(field.field_type).Pointer.child);
|
|
|
|
component_ptrs[i] = @ptrCast([*]u8, storage.instances.items.ptr);
|
|
|
|
component_ptrs[i] = @ptrCast([*]u8, storage.instances.items.ptr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -104,7 +104,7 @@ pub const OwningGroup = struct {
|
|
|
|
// fill and return the struct
|
|
|
|
// fill and return the struct
|
|
|
|
var comps: Components = undefined;
|
|
|
|
var comps: Components = undefined;
|
|
|
|
inline for (@typeInfo(Components).Struct.fields) |field, i| {
|
|
|
|
inline for (@typeInfo(Components).Struct.fields) |field, i| {
|
|
|
|
const typed_ptr = @ptrCast([*]field.field_type.Child, @alignCast(@alignOf(field.field_type.Child), it.component_ptrs[i]));
|
|
|
|
const typed_ptr = @ptrCast([*]@typeInfo(field.field_type).Pointer.child, @alignCast(@alignOf(@typeInfo(field.field_type).Pointer.child), it.component_ptrs[i]));
|
|
|
|
@field(comps, field.name) = &typed_ptr[it.index];
|
|
|
|
@field(comps, field.name) = &typed_ptr[it.index];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return comps;
|
|
|
|
return comps;
|
|
|
|