public void setup(WorldConfigurationBuilder b) { b.dependsOn(WorldConfigurationBuilder.Priority.HIGH, SuperMapper.class); } }
@Override public void setup(WorldConfigurationBuilder b) { b.register(new FieldResolver() { @Override public void initialize(World world) { } @Override public Object resolve(Object target, Class<?> fieldType, Field field) { if (fieldType.equals(Log.class)) { return createLogger(target); } return null; } }); }
/** * Add plugins to world. * <p/> * Upon build plugins will be called to register dependencies. * <p/> * Only one instance of each class is allowed. * Use {@link #dependsOn} from within plugins whenever possible. * * @param plugins Plugins to add. * @return this * @throws WorldConfigurationException if type is added more than once. */ public WorldConfigurationBuilder with(ArtemisPlugin... plugins) { addPlugins(plugins); return this; }
protected World createWorld() { return new World(new WorldConfigurationBuilder() // keeps components available until all listeners have been called. // Use this if your systems need to access components to clean up after removal. .alwaysDelayComponentRemoval(true) // Describes dependencies on plugins. You can find more example plugins commented out in build.gradle. .dependsOn( //EntityLinkManager.class, //OperationsPlugin.class, ProfilerPlugin.class, FluidEntityPlugin.class) .with( // put your own systems here! With the default InvocationStrategy they are called in order each frame. new ExampleSystem() ).build()); }
b2dRenderer = new Box2DDebugRenderer(); WorldConfiguration worldConfiguration = new WorldConfigurationBuilder() .with( new PlayerSystem(), new BombSystem(), new ParticleSystem(batch) .build();
/** * Register active system(s). * Only one instance of each class is allowed. * Use {@link #dependsOn} from within plugins whenever possible. * * @param systems systems to add, order is preserved. * @return this * @throws WorldConfigurationException if registering the same class twice. */ public WorldConfigurationBuilder with(BaseSystem... systems) { addSystems(Priority.NORMAL, systems); return this; }
/** * Register active system(s). * Only one instance of each class is allowed. * Use {@link #dependsOn} from within plugins whenever possible. * * @param systems systems to add, order is preserved. * @param priority priority of added systems, higher priority are added before lower priority. * @return this * @throws WorldConfigurationException if registering the same class twice. */ public WorldConfigurationBuilder with(int priority, BaseSystem... systems) { addSystems(priority, systems); return this; }
@Override public void setup(WorldConfigurationBuilder b) { b.register(new FieldResolver() { @Override public void initialize(World world) { } @Override public Object resolve(Object target, Class<?> fieldType, Field field) { if (fieldType.equals(Log.class)) { return createLogger(target); } return null; } }); }
/** * Register active system(s). * Only one instance of each class is allowed. * Use {@link #dependsOn} from within plugins whenever possible. * * @param systems systems to add, order is preserved. * @return this * @throws WorldConfigurationException if registering the same class twice. */ public WorldConfigurationBuilder with(BaseSystem... systems) { addSystems(Priority.NORMAL, systems); return this; }
/** * Add plugins to world. * <p/> * Upon build plugins will be called to register dependencies. * <p/> * Only one instance of each class is allowed. * Use {@link #dependsOn} from within plugins whenever possible. * * @param plugins Plugins to add. * @return this * @throws WorldConfigurationException if type is added more than once. */ public WorldConfigurationBuilder with(ArtemisPlugin... plugins) { addPlugins(plugins); return this; }
/** * Register active system(s). * Only one instance of each class is allowed. * Use {@link #dependsOn} from within plugins whenever possible. * * @param systems systems to add, order is preserved. * @param priority priority of added systems, higher priority are added before lower priority. * @return this * @throws WorldConfigurationException if registering the same class twice. */ public WorldConfigurationBuilder with(int priority, BaseSystem... systems) { addSystems(priority, systems); return this; }
/** * Specify dependency on systems/plugins. * <p/> * Managers track priority separate from system priority, and are always added before systems. * <p> * Artemis will consider abstract plugin dependencies fulfilled when a concrete subclass has been registered * beforehand. * * @param types required systems. * @return this */ public final WorldConfigurationBuilder dependsOn(Class... types) { return dependsOn(Priority.NORMAL, types); }
/** * Specify dependency on systems/plugins. * <p/> * Managers track priority separate from system priority, and are always added before systems. * <p> * Artemis will consider abstract plugin dependencies fulfilled when a concrete subclass has been registered * beforehand. * * @param types required systems. * @return this */ public final WorldConfigurationBuilder dependsOn(Class... types) { return dependsOn(Priority.NORMAL, types); }
public void setup(WorldConfigurationBuilder b) { b.dependsOn(WorldConfigurationBuilder.Priority.HIGH, SuperMapper.class); } }