-renamed callbacks:
*onAdd -> onAddEntity *onRemove -> onRemoveEntity *update -> onUpdate
This commit is contained in:
parent
d118adc028
commit
7a33e4f94f
3 changed files with 30 additions and 30 deletions
|
|
@ -95,7 +95,7 @@ class EntityManager
|
|||
{
|
||||
if (system.m_update is null)
|
||||
{
|
||||
if (system.m_entity_added || system.m_entity_removed)
|
||||
if (system.m_add_entity || system.m_remove_entity)
|
||||
{
|
||||
foreach (info; &entities_infos.byValue)
|
||||
{
|
||||
|
|
@ -570,7 +570,7 @@ class EntityManager
|
|||
string genParamsChecking()()
|
||||
{
|
||||
string ret;
|
||||
foreach (func; __traits(getOverloads, Sys, "update"))
|
||||
foreach (func; __traits(getOverloads, Sys, "onUpdate"))
|
||||
{
|
||||
if ((Parameters!(func)).length == 1)
|
||||
ret ~= "\"" ~ (fullyQualifiedName!(Sys.EntitiesData)) ~ "\" == \"" ~ (
|
||||
|
|
@ -650,7 +650,7 @@ class EntityManager
|
|||
mixin(genFillInputData());
|
||||
}
|
||||
|
||||
static if (hasMember!(Sys, "update") && (mixin(genParamsChecking())))
|
||||
static if (hasMember!(Sys, "onUpdate") && (mixin(genParamsChecking())))
|
||||
{
|
||||
static void callUpdate(ref CallData data)
|
||||
{
|
||||
|
|
@ -691,7 +691,7 @@ class EntityManager
|
|||
fillInputData(input_data, info, block, offset, entities_count, system);
|
||||
//mixin(genFillInputData());
|
||||
|
||||
s.update(input_data);
|
||||
s.onUpdate(input_data);
|
||||
|
||||
block = block.next_block;
|
||||
offset = 0;
|
||||
|
|
@ -759,8 +759,8 @@ class EntityManager
|
|||
mixin(catchFunc!(bool)("m_begin", "onBegin"));
|
||||
mixin(catchFunc("m_end", "onEnd"));
|
||||
|
||||
mixin(catchEntityFunc("m_entity_added", "onAdd"));
|
||||
mixin(catchEntityFunc("m_entity_removed", "onRemove"));
|
||||
mixin(catchEntityFunc("m_add_entity", "onAddEntity"));
|
||||
mixin(catchEntityFunc("m_remove_entity", "onRemoveEntity"));
|
||||
|
||||
system.m_system_pointer = cast(void*) Mallocator.instance.make!Sys;
|
||||
system.m_priority = priority;
|
||||
|
|
@ -1210,10 +1210,10 @@ class EntityManager
|
|||
|
||||
foreach (i, ref system; systems)
|
||||
{
|
||||
//if(system.m_entity_added || system.m_entity_removed)info.systems[system.id] = true;
|
||||
//if(system.m_add_entity || system.m_remove_entity)info.systems[system.id] = true;
|
||||
if (system.m_update is null)
|
||||
{
|
||||
if (system.m_entity_added || system.m_entity_removed)
|
||||
if (system.m_add_entity || system.m_remove_entity)
|
||||
connectListenerToEntityInfo(*info, cast(uint) i);
|
||||
continue;
|
||||
}
|
||||
|
|
@ -1253,7 +1253,7 @@ class EntityManager
|
|||
{
|
||||
System* system = &systems[i];
|
||||
//onAddEntity listener
|
||||
if (system.m_entity_added)
|
||||
if (system.m_add_entity)
|
||||
{
|
||||
//find listener position by priority
|
||||
int j;
|
||||
|
|
@ -1272,7 +1272,7 @@ class EntityManager
|
|||
tmp_add[j] = cast(ushort) i;
|
||||
}
|
||||
//onRemoveEntity listener
|
||||
if (system.m_entity_removed)
|
||||
if (system.m_remove_entity)
|
||||
{
|
||||
//find listener position by priority
|
||||
int j;
|
||||
|
|
@ -2002,7 +2002,7 @@ class EntityManager
|
|||
data.block = block;
|
||||
data.begin = begin;
|
||||
data.end = end;
|
||||
(cast(void function(ref ListenerCallData) nothrow @nogc) system.m_entity_added)(data);
|
||||
(cast(void function(ref ListenerCallData) nothrow @nogc) system.m_add_entity)(data);
|
||||
}
|
||||
|
||||
private void callRemoveEntityListeners(EntityInfo* info, EntitiesBlock* block, int begin,
|
||||
|
|
@ -2023,7 +2023,7 @@ class EntityManager
|
|||
data.block = block;
|
||||
data.begin = begin;
|
||||
data.end = end;
|
||||
(cast(void function(ref ListenerCallData) nothrow @nogc) system.m_entity_removed)(data);
|
||||
(cast(void function(ref ListenerCallData) nothrow @nogc) system.m_remove_entity)(data);
|
||||
}
|
||||
|
||||
private void updateBlocks()
|
||||
|
|
|
|||
|
|
@ -9,15 +9,15 @@ import ecs.manager;
|
|||
/************************************************************************************************************************
|
||||
*System contain data required to proper glue EntityManager with Systems.
|
||||
*System callbacks:
|
||||
*<br/>-void update(EntitesData);
|
||||
*<br/>-void onUpdate(EntitesData);
|
||||
*<br/>-void onEnable()
|
||||
*<br/>-void onDisable();
|
||||
*<br/>-bool onBegin();
|
||||
*<br/>-void onEnd();
|
||||
*<br/>-void onCreate()
|
||||
*<br/>-void onDestroy();
|
||||
*<br/>-void onAdd(EntitesData);
|
||||
*<br/>-void onRemove(EntitiesData);
|
||||
*<br/>-void onAddEntity(EntitesData);
|
||||
*<br/>-void onRemoveEntity(EntitiesData);
|
||||
*/
|
||||
struct System
|
||||
{
|
||||
|
|
@ -135,8 +135,8 @@ package:
|
|||
void* m_begin;
|
||||
void* m_end;
|
||||
|
||||
void* m_entity_added;
|
||||
void* m_entity_removed;
|
||||
void* m_add_entity;
|
||||
void* m_remove_entity;
|
||||
|
||||
//void function(ref EntityManager.CallData data) m_initialize;
|
||||
//void function(ref EntityManager.CallData data) m_deinitilize;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue