|
|
@ -67,7 +67,16 @@ pub fn World(comptime ctx: anytype) type { |
|
|
|
return Entity(ctx).new(self, config, add); |
|
|
|
return Entity(ctx).new(self, config, add); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pub fn tag(self: *Self, comptime T: type) !Entity(ctx) { |
|
|
|
|
|
|
|
if (@sizeOf(T) > 0) @compileError("'" ++ @typeName(T) ++ "' must be a zero-sized type"); |
|
|
|
|
|
|
|
const name = util.simpleTypeName(T); |
|
|
|
|
|
|
|
const result = try self.entity(.{ .name = name, .symbol = name }, .{}); |
|
|
|
|
|
|
|
Lookup(ctx, T).id = result.raw; |
|
|
|
|
|
|
|
return result; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
pub fn component(self: *Self, comptime T: type) !Entity(ctx) { |
|
|
|
pub fn component(self: *Self, comptime T: type) !Entity(ctx) { |
|
|
|
|
|
|
|
if (@sizeOf(T) == 0) @compileError("'" ++ @typeName(T) ++ "' must not be a zero-sized type"); |
|
|
|
const name = util.simpleTypeName(T); |
|
|
|
const name = util.simpleTypeName(T); |
|
|
|
const entity2 = try self.entity(.{ .name = name, .symbol = name, .use_low_id = true }, .{}); |
|
|
|
const entity2 = try self.entity(.{ .name = name, .symbol = name, .use_low_id = true }, .{}); |
|
|
|
|
|
|
|
|
|
|
|