|
|
|
@ -97,10 +97,10 @@ pub fn Id(comptime ctx: anytype) type { |
|
|
|
|
/// That is, a component without data / size. |
|
|
|
|
/// |
|
|
|
|
/// An `Id` is a tag when it .. |
|
|
|
|
/// - .. is an entity without the `EcsComponent` component. |
|
|
|
|
/// - .. has an `EcsComponent` with size member set to 0. |
|
|
|
|
/// - .. is an entity without the `Component` component. |
|
|
|
|
/// - .. has an `Component` with size member set to 0. |
|
|
|
|
/// - .. is a `Pair` where both elements are a tag. |
|
|
|
|
/// - .. is a `Pair` where `.relation` has the `EcsTag` tag. |
|
|
|
|
/// - .. is a `Pair` where `.relation` has the `Tag` tag. |
|
|
|
|
pub fn isTag(self: Self) bool { |
|
|
|
|
return c.ecs_id_is_tag(self.world.raw, self.raw); |
|
|
|
|
} |
|
|
|
@ -109,14 +109,17 @@ pub fn Id(comptime ctx: anytype) type { |
|
|
|
|
/// Only `Pair`s can be unions. |
|
|
|
|
/// |
|
|
|
|
/// An `Id` represents a union when .. |
|
|
|
|
/// - .. the `.relation` of the pair is `EcsUnion`. |
|
|
|
|
/// - .. the `.relation` of the pair has `EcsUnion`. |
|
|
|
|
/// - .. the `.relation` of the pair is `Union`. |
|
|
|
|
/// - .. the `.relation` of the pair has `Union`. |
|
|
|
|
pub fn isUnion(self: Self) bool { |
|
|
|
|
return c.ecs_id_is_union(self.world.raw, self.raw); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// Returns whether this `Id` is in use in the world. |
|
|
|
|
/// That is, if it has been added to one or more tables. |
|
|
|
|
/// |
|
|
|
|
/// Note that empty tables may reference this `Id`, in which case |
|
|
|
|
/// this function can return `true`. Consider using `count()` instead. |
|
|
|
|
pub fn isInUse(self: Self) bool { |
|
|
|
|
return c.ecs_id_in_use(self.world.raw, self.raw); |
|
|
|
|
} |
|
|
|
@ -132,21 +135,20 @@ pub fn Id(comptime ctx: anytype) type { |
|
|
|
|
// id, see ecs_get_typeid. |
|
|
|
|
// TODO: const ecs_type_info_t* ecs_get_type_info(const ecs_world_t *world, ecs_id_t id); |
|
|
|
|
|
|
|
|
|
/// Attempts to get the component type for this `Id`. |
|
|
|
|
/// Returns the entity representing the component type for this `Id`, |
|
|
|
|
/// if it is associated with a type, or `null` otherwise. |
|
|
|
|
/// |
|
|
|
|
/// This operation returns the entity representing the component type |
|
|
|
|
/// for this `Id`, if it is associated with a type. For a regular |
|
|
|
|
/// component with a non-zero size (an entity with the `EcsComponent` |
|
|
|
|
/// component) the operation will return the `Entity` itself. |
|
|
|
|
/// For a regular component with a non-zero size (an entity with the |
|
|
|
|
/// `flecs.core.Component` component) the operation will return the |
|
|
|
|
/// entity itself. |
|
|
|
|
/// |
|
|
|
|
/// For an entity that does not have the `EcsComponent` component, or |
|
|
|
|
/// with an `EcsComponent` value with size 0, the operation will |
|
|
|
|
/// return `null`. |
|
|
|
|
/// For an entity that does not have the `Component` component, or |
|
|
|
|
/// its component is zero-sized, the operation will return `null`. |
|
|
|
|
/// |
|
|
|
|
/// For a `Pair`, the operation will return the type associated with |
|
|
|
|
/// the pair, by applying the following rules in order: |
|
|
|
|
/// - If `.relation` is a component, it is returned. |
|
|
|
|
/// - If `.relation` has the `Tag` property, `null` is returned. |
|
|
|
|
/// - If `.relation` has `flecs.core.Tag`, `null` is returned. |
|
|
|
|
/// - If `.target` is a component, it is returned. |
|
|
|
|
/// - Otherwise, `null` is returned. |
|
|
|
|
pub fn typeId(self: Self) ?Entity { |
|
|
|
|