bubel-ecs/source/ecs/system.d
2018-09-12 15:28:10 +02:00

39 lines
814 B
D

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