Jump to content

  • Log In with Google      Sign In   
  • Create Account

#Actualde_mattT

Posted 12 May 2013 - 08:29 AM

Your entity_system class could store a Map of systems. The Map would use the component type as the key.

 

Pseudo code

public class entity_system
{
    private Map<Class<?>, base_system<?> systemMap;

    public void registerSystem(Class<T> componentType, base_system<T> system)
    {
        systemMap.put(componentType, system);
    }

    public <T> base_system<T> getSystem(class<T> componentType)
    {
        return systemMap.get(componentType);
    }
}

#1de_mattT

Posted 12 May 2013 - 08:28 AM

Your entity_system class could store a Map of systems. The Map would use the component type as the key.

 

Pseudo code

public class entity_system
{
private Map<Class<?>, base_system<?> systemMap;

public void registerSystem(Class<T> componentType, base_system<T> system)
{
systemMap.put(componentType, system);
}

public <T> base_system<T> getSystem(class<T> componentType)
{
return systemMap.get(componentType);
}
}

PARTNERS