master
RedStealthDev 9 months ago
parent 380dc7d68e
commit 13ae79ae3e

@ -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;

@ -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);
}
}

Loading…
Cancel
Save