-
Notifications
You must be signed in to change notification settings - Fork 113
Writing Plugins
Daan van Yperen edited this page Sep 27, 2015
·
1 revision
Provide your artemis-odb extensions as a drop in plugin!
- Users can add your odb extension with a single line of code.
- Allows other plugin developers to build upon your extension.
- Avoids dependency clashes with other extensions.
- Inject systems/managers before/after others.
Implement ArtemisPlugin
. Register dependencies via WorldConfigurationBuilder
.
When adding plugin dependencies, use WorldConfigurationBuilder#dependsOn
instead of #wire
. #DependsOn
ensures dependencies that already exist are not instanced twice. The game itself is not required to use #DependsOn
as non plugin systems/managers will be instanced before any plugins.
see WorldConfigurationBuilder for all options.
public class MyPlugin implements ArtemisPlugin {
@Override
public void setup(WorldConfigurationBuilder b) {
// hook plugins.
b.dependsOn(ExtendedComponentMapperPlugin.class);
// hook managers or systems.
b.dependsOn(TagManager.class, GroupManager.class);
b.dependsOn(MySystemA.class, MySystemB.class);
// Optionally Specify loading order.
b.with(WorldConfigurationBuilder.Priority.HIGH, new LoadFirstSystem());
// And your custom DI features!
b.register(new MyFieldResolver());
}
}
WorldConfiguration myConfig = new WorldConfigurationBuilder()
.with(new TagManager())
.with(new MyGameSystemA(), new MyGameSystemB())
.with(new MyPlugin())
.build();
- Overview
- Concepts
- Getting Started
- Using
- More guides
- Plugins
- Game Gallery
- Tools and Frameworks
- API reference