added fixme message to ecs
This commit is contained in:
parent
7ce5902ec9
commit
e1f1441a38
1 changed files with 13 additions and 10 deletions
|
|
@ -6,6 +6,8 @@ const sparse = @import("sparse.zig");
|
||||||
const System = *const fn (Pool) void;
|
const System = *const fn (Pool) void;
|
||||||
const SystemGroup = std.ArrayList(System);
|
const SystemGroup = std.ArrayList(System);
|
||||||
|
|
||||||
|
//FIXME: for some reason this thing has very weird issues with
|
||||||
|
//hash maps
|
||||||
pub const Pool = struct {
|
pub const Pool = struct {
|
||||||
// Components
|
// Components
|
||||||
position: sparse.SparseSet(components.Position),
|
position: sparse.SparseSet(components.Position),
|
||||||
|
|
@ -18,27 +20,28 @@ pub const Pool = struct {
|
||||||
last_entity: usize,
|
last_entity: usize,
|
||||||
free_ids: std.ArrayList(usize),
|
free_ids: std.ArrayList(usize),
|
||||||
|
|
||||||
component_flags: std.AutoHashMap(usize, usize),
|
component_flags: std.AutoHashMap(u32, usize),
|
||||||
|
|
||||||
pub fn init(allocator: Allocator) !@This() {
|
pub fn init(allocator: Allocator) !@This() {
|
||||||
var thread_pool: std.Thread.Pool = undefined;
|
var pool = @This(){
|
||||||
try thread_pool.init(.{
|
|
||||||
.allocator = allocator,
|
|
||||||
.n_jobs = 4,
|
|
||||||
});
|
|
||||||
|
|
||||||
return @This(){
|
|
||||||
.position = sparse.SparseSet(components.Position).init(allocator),
|
.position = sparse.SparseSet(components.Position).init(allocator),
|
||||||
.speed = sparse.SparseSet(components.Speed).init(allocator),
|
.speed = sparse.SparseSet(components.Speed).init(allocator),
|
||||||
|
|
||||||
.system_groups = std.ArrayList(SystemGroup).init(allocator),
|
.system_groups = std.ArrayList(SystemGroup).init(allocator),
|
||||||
.thread_pool = thread_pool,
|
.thread_pool = undefined,
|
||||||
.wait_group = .{},
|
.wait_group = .{},
|
||||||
.mutex = .{},
|
.mutex = .{},
|
||||||
.last_entity = 0,
|
.last_entity = 0,
|
||||||
.free_ids = std.ArrayList(usize).init(allocator),
|
.free_ids = std.ArrayList(usize).init(allocator),
|
||||||
.component_flags = std.AutoHashMap(usize, usize).init(allocator),
|
.component_flags = std.AutoHashMap(u32, usize).init(allocator),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
try pool.thread_pool.init(.{
|
||||||
|
.allocator = allocator,
|
||||||
|
.n_jobs = 4,
|
||||||
|
});
|
||||||
|
|
||||||
|
return pool;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn tick(self: *@This()) void {
|
pub fn tick(self: *@This()) void {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue