Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

@ArtemisSystem

Adrian Papari edited this page · 3 revisions

Configures an artemis EntitySystem by injecting code during the compilation phase.

The Aspect is automatically inferred and passed along in the super() call if the Aspect argument is null.

Fields for ComponentMappers, EntitySystems and Mangers are wired in the initialize method, prior to any existing code in the initialize method is executed.

Component mappers are named according to the component type they operate on, suffixed with -Mapper. Systems and managers retain their full type name. All field names are camelCased.

Minimal example

What you type:

@ArtemisSystem(
    requires={Renderable.class, Velocity.class},
    excludes={Cullable.class, AssetReference.class},
    managers={TagManager.class, GroupManager.class},
    systems=VelocitySystem.class)
public class TestSystem extends IntervalEntityProcessingSystem
{
    public TestSystem()
    {
        super(null, 0.05f);
    }

    @Override
    protected void process(Entity e)
    {
        // process system
    }
}

What the JVM gets:

@WovenByTheHuntress // marker annotation; don't process class when present
@ArtemisSystem(
    requires={Renderable.class, Velocity.class},
    excludes={Cullable.class, AssetReference.class},
    managers={TagManager.class, GroupManager.class},
    systems=VelocitySystem.class)
public class TestSystem extends IntervalEntityProcessingSystem
{
    private ComponentMapper<Renderable> renderableMapper;
    private ComponentMapper<Velocity> velocityMapper;
    private VelocitySystem velocitySystem;
    private TagManager tagManager;
    private GroupManager groupManager;

    public TestSystem()
    {
        super(Aspect.getAspectForAll(Renderable.class, Velocity.class)
            .exclude(Cullable.class, AssetReference.class), 0.05f);
    }

    @Override
    protected void initialize()
    {
        renderableMapper = world.getMapper(Renderable.class);
        velocityMapper = world.getMapper(Velocity.class);
        tagManager = world.getManager(TagManager.class);
        groupManager = world.getManager(GroupManager.class);
        velocitySystem = world.getSystem(VelocitySystem.class);
    }

    @Override
    protected void process(Entity e)
    {
        // process system
    }
}
Something went wrong with that request. Please try again.