-add ecsID template function (get Component/System/Event ID, passes tests)
-removed some ECS mixins code
This commit is contained in:
parent
13c82acad4
commit
a926b79223
9 changed files with 138 additions and 123 deletions
|
|
@ -53,6 +53,7 @@ module bubel.ecs.core;
|
|||
|
||||
public import bubel.ecs.manager;
|
||||
public import bubel.ecs.entity;
|
||||
public import bubel.ecs.traits : ecsID;
|
||||
|
||||
/************************************************************************************************************************
|
||||
Main struct used as namespace for templates.
|
||||
|
|
@ -60,12 +61,12 @@ Main struct used as namespace for templates.
|
|||
static struct ECS
|
||||
{
|
||||
/************************************************************************************************************************
|
||||
Mark structure as System. Should be added on top of structure (before any data).
|
||||
Set default system parameters (number of parallel jobs)
|
||||
*/
|
||||
mixin template System(uint jobs_count = 32)
|
||||
{
|
||||
__gshared ushort system_id = ushort.max;
|
||||
uint __ecs_jobs_count = jobs_count;
|
||||
// __gshared ushort system_id = ushort.max;
|
||||
__gshared uint __ecs_jobs_count = jobs_count;
|
||||
}
|
||||
|
||||
/************************************************************************************************************************
|
||||
|
|
@ -73,21 +74,21 @@ static struct ECS
|
|||
*/
|
||||
mixin template Component()
|
||||
{
|
||||
__gshared ushort component_id = ushort.max;
|
||||
//__gshared ushort component_id = ushort.max;
|
||||
|
||||
ComponentRef ref_() @nogc nothrow return
|
||||
{
|
||||
return ComponentRef(&this, component_id);
|
||||
return ComponentRef(&this, ecsID!(typeof(this)));
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************************************************************
|
||||
Mark structure as Event. Should be added on top of structure (before any data).
|
||||
*/
|
||||
mixin template Event()
|
||||
{
|
||||
__gshared ushort event_id = ushort.max;
|
||||
}
|
||||
// mixin template Event()
|
||||
// {
|
||||
// __gshared ushort event_id = ushort.max;
|
||||
// }
|
||||
|
||||
/************************************************************************************************************************
|
||||
Make list of excluded components. This template get structure types as argument. Should be added inside System structure.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue