diff --git a/src/EntitySystem.zig b/src/EntitySystem.zig index 74f0603..390df08 100644 --- a/src/EntitySystem.zig +++ b/src/EntitySystem.zig @@ -36,7 +36,7 @@ fn GetSignature(entity: Etyp.Entity) Etyp.Signature { var ComponentTypeList: std.StringArrayHashMap(Etyp.Component) = std.StringArrayHashMap(Etyp.Component).init(std.heap.page_allocator); -var ComponentArrays = undefined; +var ComponentArrays: std.StringArrayHashMap(usize) = std.StringArrayHashMap(usize).init(std.heap.page_allocator); var String2CompArr: std.StringArrayHashMap(usize) = std.StringArrayHashMap(usize).init(std.heap.page_allocator); var NextComponent: Etyp.Component = 0; diff --git a/src/main.zig b/src/main.zig index 03b245f..fa7ebc1 100644 --- a/src/main.zig +++ b/src/main.zig @@ -11,32 +11,26 @@ pub fn main() anyerror!void { defer rl.closeWindow(); var alloc = std.heap.ArenaAllocator.init(std.heap.page_allocator); var ptr = try alloc.allocator().create(Etyp.Transform); - ptr.* = Etyp.Transform{.pos = rl.Vector2.init(0, 0), .rot = 0}; + ptr.* = Etyp.Transform{ .pos = rl.Vector2.init(0, 0), .rot = 0 }; //rl.setTargetFPS(60); try EnS.Init(); try EnS.RegisterComponent(Etyp.Transform); - - var player = try EnS.CreateEntity(); - - EnS.AddComponent(player, Etyp.Transform{.pos = rl.Vector2.init(0, 0), .rot = 0}); + EnS.AddComponent(player, Etyp.Transform{ .pos = rl.Vector2.init(0, 0), .rot = 0 }); while (!rl.windowShouldClose()) { Etyp.Systems.Gravity(); - - rl.beginDrawing(); defer rl.endDrawing(); var pos = EnS.GetComponent(player, Etyp.Transform).pos; rl.drawRectangle(pos.x, pos.y, 5, 5, rl.Color.gold); - + rl.clearBackground(rl.Color.black); rl.drawFPS(10, 10); } } -