/** * Creates a new world. * <p> * {@link com.artemis.EntityManager}, {@link ComponentManager} and {@link AspectSubscriptionManager} are * available by default, on top of your own systems. * </p> * @see WorldConfigurationBuilder * @see WorldConfiguration */ public World(WorldConfiguration configuration) { partition = new WorldSegment(configuration); systemsBag = configuration.systems; final ComponentManager lcm = (ComponentManager) systemsBag.get(COMPONENT_MANAGER_IDX); final EntityManager lem = (EntityManager) systemsBag.get(ENTITY_MANAGER_IDX); final AspectSubscriptionManager lasm = (AspectSubscriptionManager) systemsBag.get(ASPECT_SUBSCRIPTION_MANAGER_IDX); cm = lcm == null ? new ComponentManager(configuration.expectedEntityCount()) : lcm; em = lem == null ? new EntityManager(configuration.expectedEntityCount()) : lem; asm = lasm == null ? new AspectSubscriptionManager() : lasm; batchProcessor = new BatchChangeProcessor(this); alwaysDelayComponentRemoval = configuration.isAlwaysDelayComponentRemoval(); configuration.initialize(this, partition.injector, asm); }
/** * Creates a new world. * <p> * {@link com.artemis.EntityManager}, {@link ComponentManager} and {@link AspectSubscriptionManager} are * available by default, on top of your own systems. * </p> * @see WorldConfigurationBuilder * @see WorldConfiguration */ public World(WorldConfiguration configuration) { partition = new WorldSegment(configuration); systemsBag = configuration.systems; final ComponentManager lcm = (ComponentManager) systemsBag.get(COMPONENT_MANAGER_IDX); final EntityManager lem = (EntityManager) systemsBag.get(ENTITY_MANAGER_IDX); final AspectSubscriptionManager lasm = (AspectSubscriptionManager) systemsBag.get(ASPECT_SUBSCRIPTION_MANAGER_IDX); cm = lcm == null ? new ComponentManager(configuration.expectedEntityCount()) : lcm; em = lem == null ? new EntityManager(configuration.expectedEntityCount()) : lem; asm = lasm == null ? new AspectSubscriptionManager() : lasm; batchProcessor = new BatchChangeProcessor(this); alwaysDelayComponentRemoval = configuration.isAlwaysDelayComponentRemoval(); configuration.initialize(this, partition.injector, asm); }