-change ecsID to becsID
-change component_id/system_id to becsID in demos
This commit is contained in:
parent
a926b79223
commit
a6d92cb21b
17 changed files with 296 additions and 272 deletions
|
|
@ -1,6 +1,6 @@
|
|||
/************************************************************************************************************************
|
||||
This module contain main templates for user.
|
||||
There are three structure templates (mixins) which should be added on top of structure:
|
||||
This module contain main helper templates for user.
|
||||
There are three structure templates (mixins) which can be added on top of structure:
|
||||
$(LIST
|
||||
* System: make system structure
|
||||
* Component: make component structure
|
||||
|
|
@ -46,6 +46,26 @@ Struct System1
|
|||
}
|
||||
---
|
||||
|
||||
Templates ReadOnlyDependencies nad WritableDependencies are used to create list of dependencies for System.
|
||||
Writable dependencies are bloking parallel execution of system which has same dependency (as writable or readonly).
|
||||
This dependencies works same as Component dependencies but can be used for creating external dependencies (e.g. dependency on spatial partitioning tree access).
|
||||
|
||||
---
|
||||
enum ExternalDependency1 = "ExternalDependency1";
|
||||
|
||||
Struct System1
|
||||
{
|
||||
mixin!ECS.System;
|
||||
|
||||
struct EntitiesData
|
||||
{
|
||||
... //used components
|
||||
}
|
||||
|
||||
ReadOnlyDependencies!(ExternalDependency1);
|
||||
}
|
||||
---
|
||||
|
||||
Copyright: Copyright © 2018-2019, Dawid Masiukiewicz, Michał Masiukiewicz
|
||||
License: BSD 3-clause, see LICENSE file in project root folder.
|
||||
*/
|
||||
|
|
@ -53,7 +73,7 @@ module bubel.ecs.core;
|
|||
|
||||
public import bubel.ecs.manager;
|
||||
public import bubel.ecs.entity;
|
||||
public import bubel.ecs.traits : ecsID;
|
||||
public import bubel.ecs.traits : becsID;
|
||||
|
||||
/************************************************************************************************************************
|
||||
Main struct used as namespace for templates.
|
||||
|
|
@ -65,30 +85,27 @@ static struct ECS
|
|||
*/
|
||||
mixin template System(uint jobs_count = 32)
|
||||
{
|
||||
// __gshared ushort system_id = ushort.max;
|
||||
__gshared uint __ecs_jobs_count = jobs_count;
|
||||
__gshared uint __becs_jobs_count = jobs_count;
|
||||
}
|
||||
|
||||
/************************************************************************************************************************
|
||||
Mark structure as Component. Should be added on top of structure (before any data).
|
||||
Mark structure as Component
|
||||
*/
|
||||
mixin template Component()
|
||||
{
|
||||
//__gshared ushort component_id = ushort.max;
|
||||
|
||||
ComponentRef ref_() @nogc nothrow return
|
||||
{
|
||||
return ComponentRef(&this, ecsID!(typeof(this)));
|
||||
return ComponentRef(&this, becsID!(typeof(this)));
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************************************************************
|
||||
Mark structure as Event. Should be added on top of structure (before any data).
|
||||
Mark structure as Event
|
||||
*/
|
||||
// mixin template Event()
|
||||
// {
|
||||
// __gshared ushort event_id = ushort.max;
|
||||
// }
|
||||
mixin template Event()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/************************************************************************************************************************
|
||||
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