-LinearLayout proggress:
*EntityTemplate.getComponent *Adding/removing components for Entitites -better code for adding components
This commit is contained in:
parent
cb9bac5dde
commit
c18ac54265
4 changed files with 95 additions and 40 deletions
|
|
@ -79,10 +79,10 @@ int main()
|
|||
__gshared ushort component_id;
|
||||
uint gg = 7; //good game
|
||||
uint bg = 8; //bad game
|
||||
ulong a;
|
||||
ulong b;
|
||||
ulong c;
|
||||
ulong g;
|
||||
ulong a = 9;
|
||||
ulong b = 10;
|
||||
ulong c = 11;
|
||||
ulong g = 12;
|
||||
|
||||
static void serializeComponent(ref TestComp comp, SerializeVector output)
|
||||
{
|
||||
|
|
@ -260,10 +260,12 @@ int main()
|
|||
|
||||
time = MonoTime.currTime;
|
||||
|
||||
ushort[3] ids = [TestComp2.component_id, TestComp.component_id, TestComp4.component_id];
|
||||
//ushort[3] ids = [TestComp2.component_id, TestComp.component_id, TestComp4.component_id];
|
||||
ushort[2] ids = [TestComp2.component_id, TestComp.component_id];
|
||||
EntityTemplate* tmpl = gEM.allocateTemplate(ids);
|
||||
|
||||
ushort[3] ids2 = [TestComp3.component_id, TestComp.component_id, TestComp4.component_id];
|
||||
//ushort[3] ids2 = [TestComp3.component_id, TestComp.component_id, TestComp4.component_id];
|
||||
ushort[2] ids2 = [TestComp3.component_id, TestComp.component_id];
|
||||
EntityTemplate* tmpl2 = gEM.allocateTemplate(ids2);
|
||||
//writeln(tmpl.info.components[]);
|
||||
//*cast(EntityID*) tmpl.entity_data.ptr = EntityID(1, 1);
|
||||
|
|
@ -286,7 +288,7 @@ int main()
|
|||
|
||||
EntityID[1000] idss;
|
||||
|
||||
/*foreach (i; 0 .. 1_000)
|
||||
foreach (i; 0 .. 1_000)
|
||||
{
|
||||
gEM.begin();
|
||||
foreach (j; 0 .. 1_000)
|
||||
|
|
@ -294,7 +296,7 @@ int main()
|
|||
foreach (j; 0 .. 1_000)
|
||||
gEM.removeEntity(idss[j]);
|
||||
gEM.end();
|
||||
}*/
|
||||
}
|
||||
|
||||
dur = (MonoTime.currTime - time).total!"usecs";
|
||||
writeln("Entities adding: ", dur, " usecs");
|
||||
|
|
@ -375,6 +377,7 @@ int main()
|
|||
writeEntityComponents(gEM.getEntity(entity.id));
|
||||
|
||||
gEM.removeComponents!(TestComp)(entity.id);
|
||||
gEM.addComponents(entity.id, TestComp());
|
||||
|
||||
gEM.begin();
|
||||
gEM.update();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue