|
|
|
@ -141,6 +141,28 @@ pub fn Entity(comptime ctx: anytype) type { |
|
|
|
|
c.ecs_delete(self.world.raw, self.raw); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// Gets the name of this `Entity`, or `null` if none. |
|
|
|
|
pub fn getName(self: Self) ?[:0]const u8 { |
|
|
|
|
const result = c.ecs_get_name(self.world.raw, self.raw); |
|
|
|
|
return std.mem.sliceTo(result, 0); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// Gets the symbol of this `Entity`, or `null` if none. |
|
|
|
|
pub fn getSymbol(self: Self) ?[:0]const u8 { |
|
|
|
|
const result = c.ecs_get_symbol(self.world.raw, self.raw); |
|
|
|
|
return std.mem.sliceTo(result, 0); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// Sets the name of this `Entity` to the specified value, if any. |
|
|
|
|
pub fn setName(self: Self, value: ?[*:0]const u8) void { |
|
|
|
|
_ = c.ecs_set_name(self.world.raw, self.raw, value); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// Sets the symbol of this `Entity` to the specified value, if any. |
|
|
|
|
pub fn setSymbol(self: Self, value: ?[*:0]const u8) void { |
|
|
|
|
_ = c.ecs_set_symbol(self.world.raw, self.raw, value); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
pub fn get(self: Self, comptime T: type) ?*const T { |
|
|
|
|
const id = Lookup(ctx, T).id; |
|
|
|
|
return @alignCast(@ptrCast(c.ecs_get_id(self.world.raw, self.raw, id))); |
|
|
|
|