-
Notifications
You must be signed in to change notification settings - Fork 20
Singleton Plugin
Daan van Yperen edited this page May 31, 2019
·
4 revisions
In artemis-odb-contrib 2.5.0-SNAPSHOT, release planned for artemis-odb 2.3.0. Desktop only
Handles singleton component lifecycle and injection. Makes it easy to locate and access singleton components.
Using this plugin can help decouple systems, follow a stateless/pure behavior system pattern, and make it easier to serialize system state.
Some example singletons: Configuration, Map, Keybindings, Console, Score, Player, Camera.
<parent>
<groupId>net.mostlyoriginal.artemis-odb</groupId>
<artifactId>contrib-plugin-singleton</artifactId>
<version>2.5.0-SNAPSHOT</version>
</parent>
@Singleton
class KeyBindingComponent extends Component {
...
}
class PlayerControlSystem extends BaseSystem {
private KeyBindingComponent keybindings; // auto injected.
...
}