You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
const std = @import("std");
|
|
|
|
const Etyp = @import("EntitySystemTypes.zig");
|
|
|
|
|
|
|
|
//Variables Entity
|
|
|
|
|
|
|
|
const EntityIDs: std.TailQueue(u32) = init: {
|
|
|
|
var temp = std.TailQueue(u32);
|
|
|
|
var i = 0;
|
|
|
|
while (i < Etyp.MAXEntitys) {
|
|
|
|
temp.append(i);
|
|
|
|
i += 1;
|
|
|
|
}
|
|
|
|
break :init temp;
|
|
|
|
};
|
|
|
|
var EntityAmount: u32 = 0;
|
|
|
|
|
|
|
|
const Signatures: [Etyp.MAXEntitys]Etyp.Signature = undefined;
|
|
|
|
|
|
|
|
//Entity System
|
|
|
|
|
|
|
|
pub fn CreateEntity() !Etyp.entity {
|
|
|
|
if (EntityAmount >= Etyp.MAXEntitys) {
|
|
|
|
return error{};
|
|
|
|
}
|
|
|
|
EntityAmount += 1;
|
|
|
|
return EntityIDs.popFirst();
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn DestroyEntity(entity: Etyp.entity) void {
|
|
|
|
Signatures[entity] = null;
|
|
|
|
EntityIDs.append(entity);
|
|
|
|
EntityAmount -= 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn SetSignature(entity: Etyp.entity, signature: Etyp.Signature) void {
|
|
|
|
Signatures[entity] = signature;
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn GetSignature(entity: Etyp.entity) Etyp.signature {
|
|
|
|
return Signatures[entity];
|
|
|
|
}
|
|
|
|
|
|
|
|
//Component Manager
|
|
|
|
|
|
|
|
pub fn RegisterComponent() void {
|
|
|
|
|
|
|
|
}
|