com.artemis.utils.IntBag Java Examples
The following examples show how to use
com.artemis.utils.IntBag.
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: RenderSystem.java From riiablo with Apache License 2.0 | 6 votes |
private void buildCache(Array<Integer>[] cache, Map.Zone zone, int stx, int sty) { cache[0].size = cache[1].size = cache[2].size = 0; int orderFlag; IntBag entitites = getEntityIds(); for (int i = 0, size = entitites.size(); i < size; i++) { int id = entitites.get(i); Vector2 pos = mPosition.get(id).position; if ((stx <= pos.x && pos.x < stx + Tile.SUBTILE_SIZE) && (sty <= pos.y && pos.y < sty + Tile.SUBTILE_SIZE)) { Object objectComponent = mObject.get(id); if (objectComponent != null) { CofReference reference = mCofReference.get(id); orderFlag = objectComponent.base.OrderFlag[reference.mode]; } else { orderFlag = stx == pos.x || sty == pos.y ? 2 : 0; } cache[orderFlag].add(id); } } cache[0].sort(SUBTILE_ORDER); cache[1].sort(SUBTILE_ORDER); cache[2].sort(SUBTILE_ORDER); }
Example #2
Source File: DispersedIntervalEntitySystem.java From mini2Dx with Apache License 2.0 | 6 votes |
/** * 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 #3
Source File: NetworkSynchronizer.java From riiablo with Apache License 2.0 | 5 votes |
@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 #4
Source File: NetworkSynchronizer.java From riiablo with Apache License 2.0 | 5 votes |
@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 #5
Source File: CofLayerUnloader.java From riiablo with Apache License 2.0 | 5 votes |
@Override protected void dispose() { IntBag entities = getEntityIds(); for (int i = 0, size = entities.size(); i < size; i++) { int id = entities.get(i); AssetDescriptor<? extends DC>[] descriptors = mCofComponentDescriptors.get(id).descriptors; for (int c = 0; c < descriptors.length; c++) { layerLoader.unload(c, descriptors); } } }
Example #6
Source File: CursorMovementSystem.java From riiablo with Apache License 2.0 | 5 votes |
private boolean touchDown(int src) { IntBag hoveredEntities = hoveredSubscriber.getEntities(); if (hoveredEntities.size() == 0) return false; int target = hoveredEntities.get(0); setTarget(src, target); return true; }
Example #7
Source File: CofUnloader.java From riiablo with Apache License 2.0 | 5 votes |
@Override protected void dispose() { IntBag entities = getEntityIds(); for (int i = 0, size = entities.size(); i < size; i++) { int id = entities.get(i); unload(id); } }
Example #8
Source File: SoundEmitterHandler.java From riiablo with Apache License 2.0 | 5 votes |
@Override protected void dispose() { IntBag entities = getEntityIds(); for (int i = 0, size = entities.size(); i < size; i++) { int id = entities.get(i); unload(id); } }
Example #9
Source File: MonsterLabelManager.java From riiablo with Apache License 2.0 | 5 votes |
@Override protected void processSystem() { IntBag entities = getEntityIds(); if (entities.size() > 0) { int firstId = entities.get(0); monsterLabel.set(firstId); monsterLabel.setVisible(true); } }
Example #10
Source File: GameScreen.java From riiablo with Apache License 2.0 | 5 votes |
public void setAct(int act) { player = Engine.INVALID_ENTITY; IntBag entities = engine.getAspectSubscriptionManager().get(Aspect.all()).getEntities(); for (int i = 0, size = entities.size(); i < size; i++) { engine.delete(entities.get(i)); } engine.getSystem(Box2DPhysics.class).clear(); loadingScreen.loadAct(act); Riiablo.client.pushScreen(loadingScreen); }
Example #11
Source File: OperationTestUtil.java From artemis-odb-orion with Apache License 2.0 | 4 votes |
public static IntBag operatives(World world) { return world.getAspectSubscriptionManager() .get(all(Operative.class)) .getEntities(); }
Example #12
Source File: DispersedIntervalEntitySystem.java From mini2Dx with Apache License 2.0 | 4 votes |
@Override public final void inserted(IntBag entities) { shouldSyncEntities = true; if ((methodFlags & FLAG_INSERTED) > 0) super.inserted(entities); }
Example #13
Source File: DispersedIntervalEntitySystem.java From mini2Dx with Apache License 2.0 | 4 votes |
@Override public final void removed(IntBag entities) { shouldSyncEntities = true; if ((methodFlags & FLAG_REMOVED) > 0) super.removed(entities); }