-move code from templates to ECS side:

*sendEvent - using EventRef (alias to ComponentRef)
 *ListenerCallData now contain entities count and pointer to EntityInfo
 *Remove system_pointer from SystemCallData (use context instead)
 *Register event
-Now all BECS functinality can be used without templates
-clean code
This commit is contained in:
Mergul 2021-03-24 18:35:03 +01:00
parent 0d08b8532a
commit 70a5388820
5 changed files with 126 additions and 261 deletions

View file

@ -283,13 +283,13 @@ struct ChangeTestSystem
bool onBegin()
{
////writeln("On Test System begin.");
// writeln("On Test System begin.");
return true;
}
void onEnd()
{
////writeln("On Test System end.");
// writeln("On Test System end.");
}
void initialize(ref Entity entity, ref TestComp comp)
@ -307,10 +307,10 @@ struct ChangeTestSystem
void onUpdate(EntitiesData data)
{
foreach (i; 0 .. data.length)
/*foreach (i; 0 .. data.length)
{
}
}*/
}
}
@ -318,6 +318,8 @@ struct TestSystem
{
mixin ECS.System!16; //__gshared ushort system_id;
uint print = 1;
void onCreate()
{
//writeln("On Test System create.");
@ -343,13 +345,14 @@ struct TestSystem
bool onBegin()
{
////writeln("On Test System begin.");
if(print)printf("On Test System begin.\n");
return true;
}
void onEnd()
{
////writeln("On Test System end.");
if(print)printf("On Test System end.\n");
print = 0;
}
void initialize(ref Entity entity, ref TestComp comp)
@ -406,7 +409,7 @@ struct TestSystemWithHighPriority
void initialize(ref Entity entity, ref TestComp comp)
{
int o = 1;
}
void onUpdate(EntitiesData data)
@ -844,6 +847,7 @@ else:
//dur = (MonoTime.currTime - time).total!"usecs";
//writeln("Entities adding: ", dur, " usecs");
printf("Entities adding: %f usecs\n", cast(float)(Time.getUSecTime() - time));
Mallocator.dispose(idss);
time = Time.getUSecTime();
uint blocks = 0;
@ -1021,8 +1025,6 @@ else:
gEntityManager.freeTemplate(copy_default_tempalte);
EntityManager.destroy();
Mallocator.dispose(idss);
printf("end\n"); //*/
return 0;