bubel-ecs/source/ecs/system.d
Mergul 4b19907c03 -formatted all files with dfmt
-more messy tests
-some documentation
-some useful code moved to functions
-adding components to existing entity
-opportunity to get entity by ID
-fixed calculating deltas
-sorting IDs arrays for allocating Templates
-fixed alignment caluclation
-added compile-time checks for "component_id" member existing in component
2018-09-13 00:10:48 +02:00

48 lines
924 B
D

module ecs.system;
import ecs.entity;
import ecs.manager;
struct System
{
bool enabled()
{
return m_enabled;
}
void enable()
{
if (!m_enabled && m_enable)
m_enable(m_system_pointer);
m_enabled = true;
}
void disable()
{
if (m_enabled && m_disable)
m_disable(m_system_pointer);
m_enabled = false;
}
int priority()
{
return m_priority;
}
package:
///should system update and catch events?
bool m_enabled = false;
///system priority
int m_priority;
///pointer to system implementation
void* m_system_pointer;
uint[] m_components;
//void function(ref EntityManager.CallData data, void* entity) update;
void* m_update; ///workaroud for DMD bug with upper line
void function(void* system_pointer) m_enable;
void function(void* system_pointer) m_disable;
}