Skip to content
Adrian Papari edited this page Jun 24, 2016 · 13 revisions

Run-time

@AspectDescriptor

Injects aspect-related types. See Dependency Injection for more info.

@AspectDescriptor(
    all = {Scale.class, Tint.class},
    exclude = Velocity.class)
private EntityTransmuter transmuter;

@DelayedComponentRemoval

Ensuring removed components are retrievable until all SubscriptionListeners have been informed.

world.getAspectSubscriptionManager()
    .get(Aspect.all(Renderable.class))
    .addSubscriptionListener(new SubscriptionListener() {
        @Override
        public void inserted(IntBag entities) {}

        @Override
        public void removed(IntBag entities) {
            for (int i = 0, s = entities.size(); s > i; i++) {
                // without @DelayedCompoentRemoval on Renderable,
                // this may be null
                Renderable renderable = renderableMapper.get(entities.get(i));
                
            }
        }
    });

@EntityId

Marks an int or IntBag fields as holding entities. Serialization and EntityLinkManager both use this annotation.

@PooledWeaver
public class InheritScale extends Component {    
    @EntityId public int target = -1;
}

@LinkPolicy

Configures the method with which EntityLinkManager checks inter-entity relationships - on a per field basis.

public class ChildRenderable extends PooledComponent {
    @EntityId @LinkPolicy(CHECK_SOURCE_AND_TARGETS)
    public IntBag children = new IntBag();
}

@SkipWire

Disables dependency injection for the current class or field.

@SkipWire
public class NoInjectSystem extends IteratingSystem {

@Transient

Marks component as un-serializable. Transient component types are not included in the serialized output.

@Transient
public class Renderable extends Component {
    public Sprite sprite;
}

@UnstableApi

Marker annotation.

@Wire

Injecting objects registered with WorldConfiguration#register:

@Wire(name = "ui.camera")
private OrthographicCamera camera;

Injecting fields inherited from parent classes:

@Wire(injectInherited = true)
public final class LayerHud extends AnimatedHudWidget<VisTable> {

For more options, see @Wire.

compile-time

Annotations are processed by the maven or gradle plugin. Plugin setup is described on Bytecode weaving. All compile-time annotations work directly on class files. No source files are generated or modified.

@PooledWeaver

Rewrites the component into a pooled component. Pooled components are managed by the world instance.

@PooledWeaver
public class Size extends Component {
    public float width = 10;
    public float height;
}

becomes:

public class Size extends PooledComponent {
    public float width = 10;
    public float height;

    @Override
    protected void reset() {
        width = 10;
        height = 0;
    }
}

@PreserveProcessVisiblity

Annotation for preserving the access visibiliy of process(e). Necessary if an external class invokes the system's per entity-process method directly.

@Profile

Profile system execution with custom profilers. Injects conditional profiler call at start of begin() and before any exit point in end()

@Profile(enabled=true, using=SimpleProfiler.class)
public class ProfiledSystem extends IteratingSystem {
Clone this wiki locally