-Systems, Components and Events now must have proper mixin. Mixins are located in ecs.core module. (i.e. mixin ECS.Component)

-Multithreading support:
 *multithreaded update - updateMT(), function generates jobs to execute
 *added dispatch callback function to dispatch generated jobs (setJobDispachFunc)
 *added getID callback for get thread ID by EntityManager
-added Job structure. Job has one function "execute()".
-calling partial info update (required to multithreading)
-multithreaded removeEntity, addCompoenents, removeComponents. Every thread has own data and remove/change lists.
-multithreaded addEntity (WIP)
-fixed issue with duplicating components
-simpler and faster "findBlockWithFreeSpace" function
-CallDataAllocator, allocator for CallDatas (used for Jobs)
-fixed some bugs/issues
This commit is contained in:
Mergul 2018-10-14 16:59:46 +02:00
parent 3a767babc0
commit 5dd24b6462
6 changed files with 519 additions and 135 deletions

View file

@ -8,6 +8,7 @@ import ecs.manager;
*/
struct System
{
/************************************************************************************************************************
*Check if system is enabled.
*/
@ -22,7 +23,7 @@ struct System
export void enable()
{
if (!m_enabled && m_enable)
m_enable(m_system_pointer);
(cast(void function(void*))m_enable)(m_system_pointer);
m_enabled = true;
}
@ -32,7 +33,7 @@ struct System
export void disable()
{
if (m_enabled && m_disable)
m_disable(m_system_pointer);
(cast(void function(void*))m_disable)(m_system_pointer);
m_enabled = false;
}
@ -63,17 +64,28 @@ package:
///optional components
ushort[] m_optional_components;
EntityManager.Job[] jobs;
//void function(ref EntityManager.CallData data) m_update;
void* m_update; ///workaroud for DMD bug with upper line
void function(void* system_pointer) m_enable;
/*void function(void* system_pointer) m_enable;
void function(void* system_pointer) m_disable;
void function(void* system_pointer) m_create;
void function(void* system_pointer) m_destroy;
void function(void* system_pointer) m_begin;
void function(void* system_pointer) m_end;
void function(void* system_pointer) m_end;*/
void* m_enable;
void* m_disable;
void* m_create;
void* m_destroy;
void* m_begin;
void* m_end;
//void function(ref EntityManager.CallData data) m_initialize;
//void function(ref EntityManager.CallData data) m_deinitilize;