Java Code Examples for com.artemis.utils.IntBag#getData()

The following examples show how to use com.artemis.utils.IntBag#getData() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DispersedIntervalEntitySystem.java    From mini2Dx with Apache License 2.0 6 votes vote down vote up
/**
 * Gets the entities processed by this {@link DispersedIntervalEntitySystem}. Warning: do not delete entities from
 * this bag.
 *
 * @return {@link DispersedIntervalEntitySystem}'s entity bag, as matched by {@link Aspect}.
 */
public Bag<Entity> getEntities() {
    if (shouldSyncEntities) {
        int oldSize = entities.size();
        entities.setSize(0);
        IntBag entityIds = subscription.getEntities();
        int[] ids = entityIds.getData();
        for (int i = 0; i < entityIds.size(); i++) {
            entities.add(world.getEntity(ids[i]));
        }

        if (oldSize > entities.size()) {
            Arrays.fill(entities.getData(), entities.size(), oldSize, null);
        }

        shouldSyncEntities = false;
    }

    return entities;
}
 
Example 2
Source File: NetworkSynchronizer.java    From riiablo with Apache License 2.0 5 votes vote down vote up
@Override
protected void processSystem() {
  IntBag entities = subscription.getEntities();
  int[] entityIds = entities.getData();
  for (int i = 0, s = entities.size(); i < s; i++) {
    process(entityIds[i]);
  }
}
 
Example 3
Source File: NetworkSynchronizer.java    From riiablo with Apache License 2.0 5 votes vote down vote up
@Override
protected void processSystem() {
  IntBag entities = subscription.getEntities();
  int[] entityIds = entities.getData();
  for (int i = 0, s = entities.size(); i < s; i++) {
    process(entityIds[i]);
  }
}