|
|
@ -254,6 +254,14 @@ pub fn Entity(comptime ctx: anytype) type { |
|
|
|
return if (result != 0) fromRaw(self.world, result) else null; |
|
|
|
return if (result != 0) fromRaw(self.world, result) else null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Returns whether this `Entity` has the specified value. |
|
|
|
|
|
|
|
/// |
|
|
|
|
|
|
|
/// `value` must be convertible to an id. See also: `util.anyToId(...)`. |
|
|
|
|
|
|
|
pub fn has(self: Self, value: anytype) bool { |
|
|
|
|
|
|
|
const id = util.anyToId(ctx, value); |
|
|
|
|
|
|
|
return c.ecs_has_id(self.world.raw, self.raw, id); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
pub fn get(self: Self, comptime T: type) ?*const T { |
|
|
|
pub fn get(self: Self, comptime T: type) ?*const T { |
|
|
|
const id = Lookup(ctx, T).id; |
|
|
|
const id = Lookup(ctx, T).id; |
|
|
|
return @alignCast(@ptrCast(c.ecs_get_id(self.world.raw, self.raw, id))); |
|
|
|
return @alignCast(@ptrCast(c.ecs_get_id(self.world.raw, self.raw, id))); |
|
|
|