From eb2e8d13fa7c81a5dc0714be4012b522280d49cc Mon Sep 17 00:00:00 2001 From: jjanzen Date: Tue, 21 Jan 2025 21:46:21 -0600 Subject: rigorous ecs implementation --- src/ecs/component.zig | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) (limited to 'src/ecs/component.zig') diff --git a/src/ecs/component.zig b/src/ecs/component.zig index 4a10172..37956d0 100644 --- a/src/ecs/component.zig +++ b/src/ecs/component.zig @@ -11,29 +11,10 @@ pub const ComponentStub = struct { } }; -pub const ComponentType = enum(usize) { - component_stub = 0, +pub const ComponentType = enum { + component_stub, }; -pub const Component = union(ComponentType) { - component_stub: ComponentStub, - - pub fn init(t: ComponentType, args: anytype) Component { - switch (t) { - ComponentType.component_stub => return Component{ - .component_stub = ComponentStub.init(args), - }, - } - } - - pub fn deinit(self: *Component) void { - switch (self.*) { - .component_stub => |*comp| comp.deinit(), - } - } +pub const Components = struct { + component_stub: ?ComponentStub, }; - -test "stub component" { - var stub = Component.init(ComponentType.component_stub, .{}); - defer stub.deinit(); -} -- cgit v1.2.3