-
Notifications
You must be signed in to change notification settings - Fork 113
Annotations
Injects aspect-related types. See Dependency Injection for more info.
@AspectDescriptor(
all = {Scale.class, Tint.class},
exclude = Velocity.class)
private EntityTransmuter transmuter;
Ensuring removed components are retrievable until all SubscriptionListeners have been informed.
@DelayedComponentRemoval
public class ProlongedLife extends Component {
public float life;
}
Without @DelayedComponentRemoval
, explicit component removal is instantaneous:
world.getAspectSubscriptionManager()
.get(Aspect.all(ProlongedLife.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 @DelayedComponentRemoval on ProlongedLife,
// this may be null
ProlongedLife pf = prolongedLifeMapper.get(entities.get(i));
}
}
});
Marks an int
or IntBag
field as entity-referencing. Serialization and EntityLinkManager both use this annotation. Entity
and Bag<Entity>
naturally don't require it.
@PooledWeaver
public class InheritScale extends Component {
@EntityId public int target = -1;
}
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();
}
Holds the path or identifier for prefabs. The value from this annotation is passed to the corresponding PrefabReader
.
@PrefabData("prefab/player.json")
public class PlayerPrefab extends Prefab {
private ComponentMapper<Position> positionMapper;
public PlayerPrefab(World world) {
super(world, new LocalFileHandleResolver());
}
public SaveFileFormat createPlayer(float x, float y) {
SaveFileFormat sfl = create();
Entity player = sfl.get("player");
positionMapper.get(player).xy.set(x, y);
return sfl;
}
}
Disables dependency injection for the current class or field.
@SkipWire
public class NoInjectSystem extends IteratingSystem {
Marks component as un-serializable. Transient component types are not included in the serialized output.
@Transient
public class Renderable extends Component {
public Sprite sprite;
}
Marker annotation.
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.
Annotations are processed by the maven or gradle plugin. Plugin setup is described in Bytecode weaving. All compile-time annotations work directly on class files. No source files are generated or modified.
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;
}
}
Preserves the access visibility of the annotated system's process(e)
method. Necessary if an external class needs to invoke the method directly.
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 {
- Overview
- Concepts
- Getting Started
- Using
- More guides
- Plugins
- Game Gallery
- Tools and Frameworks
- API reference