Heap allocate the entity array
This commit is contained in:
parent
53d443f480
commit
4bee083cc4
1 changed files with 4 additions and 2 deletions
|
|
@ -21,12 +21,14 @@ pub const Entity = struct {
|
||||||
pub const MAX_ENTITIES: usize = 1_000_000;
|
pub const MAX_ENTITIES: usize = 1_000_000;
|
||||||
|
|
||||||
pub const Entities = struct {
|
pub const Entities = struct {
|
||||||
items: [MAX_ENTITIES]Entity,
|
items: []Entity,
|
||||||
count: usize,
|
count: usize,
|
||||||
|
|
||||||
|
var backing: [MAX_ENTITIES]Entity = undefined;
|
||||||
|
|
||||||
pub fn init() Entities {
|
pub fn init() Entities {
|
||||||
return .{
|
return .{
|
||||||
.items = undefined,
|
.items = &backing,
|
||||||
.count = 0,
|
.count = 0,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue