Exemple #1
0
 /**
  * Create and return an {@link Entity} wrapping a new or reused entity instance. Entity is
  * automatically added to the world.
  *
  * <p>Use {@link Entity#edit()} to set up your newly created entity.
  *
  * <p>You can also create entities using: - {@link com.artemis.utils.EntityBuilder} Convenient
  * entity creation. Not useful when pooling. - {@link com.artemis.Archetype} Fastest, low level,
  * no parameterized components. - {@link com.artemis.EntityFactory} Fast, clean and convenient.
  * For fixed composition entities. Requires some setup. Best choice for parameterizing pooled
  * components.
  *
  * @return assigned entity id
  */
 public int create(Archetype archetype) {
   int entityId = em.create(archetype);
   cm.addComponents(entityId, archetype);
   changed.set(entityId);
   return entityId;
 }
Exemple #2
0
 /**
  * Create and return an {@link Entity} wrapping a new or reused entity instance. Entity is
  * automatically added to the world.
  *
  * <p>Use {@link Entity#edit()} to set up your newly created entity.
  *
  * <p>You can also create entities using: - {@link com.artemis.utils.EntityBuilder} Convenient
  * entity creation. Not useful when pooling. - {@link com.artemis.Archetype} Fastest, low level,
  * no parameterized components. - {@link com.artemis.EntityFactory} Fast, clean and convenient.
  * For fixed composition entities. Requires some setup. Best choice for parameterizing pooled
  * components.
  *
  * @see #create(int) recommended alternative.
  * @return entity
  */
 public Entity createEntity(Archetype archetype) {
   Entity e = em.createEntityInstance(archetype);
   cm.addComponents(e.getId(), archetype);
   changed.set(e.getId());
   return e;
 }