|
|
@ -277,10 +277,11 @@ pub fn Entity(comptime ctx: anytype) type { |
|
|
|
c.ecs_remove_id(self.world.raw, self.raw, ecs_id); |
|
|
|
c.ecs_remove_id(self.world.raw, self.raw, ecs_id); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
pub fn get(self: Self, comptime T: type) ?*const T { |
|
|
|
pub fn get(self: Self, comptime T: type) ?T { |
|
|
|
const id = Lookup(ctx, T).id; |
|
|
|
const id = Lookup(ctx, T).id; |
|
|
|
const ptr = c.ecs_get_id(self.world.raw, self.raw, id); |
|
|
|
const ptr = c.ecs_get_id(self.world.raw, self.raw, id); |
|
|
|
return @alignCast(@ptrCast(ptr)); |
|
|
|
const typed_ptr: ?*const T = @alignCast(@ptrCast(ptr)); |
|
|
|
|
|
|
|
return if (typed_ptr) |p| p.* else null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
pub fn get_mut(self: Self, comptime T: type) ?*T { |
|
|
|
pub fn get_mut(self: Self, comptime T: type) ?*T { |
|
|
|