Java Code Examples for com.badlogic.gdx.utils.ObjectSet#addAll()
The following examples show how to use
com.badlogic.gdx.utils.ObjectSet#addAll() .
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: GameServicesMultiplayer.java From dice-heroes with GNU General Public License v3.0 | 6 votes |
@SuppressWarnings("unchecked") public void loadInvitations(InvitationBuffer invitations) { ObjectSet<String> tmp = Pools.obtain(ObjectSet.class); tmp.addAll(invites); invites.clear(); for (Invitation invitation : invitations) { invites.add(invitation.getInvitationId()); if (!tmp.contains(invitation.getInvitationId())) { showInvitation(invitation); } } tmp.clear(); Pools.free(tmp); Gdx.app.postRunnable(new Runnable() { @Override public void run() { invitesDispatcher.setState(invites.size); } }); }
Example 2
Source File: SpawnController.java From dice-heroes with GNU General Public License v3.0 | 5 votes |
@SuppressWarnings("unchecked") private void autoPlace() { if (placed.size > 0) { ObjectSet<Creature> tmp = Pools.obtain(ObjectSet.class); tmp.addAll(placed); for (Creature c : tmp) { removeFromPlaced(c); } tmp.clear(); Pools.free(tmp); } Array<Grid2D.Coordinate> coordinates = Pools.obtain(Array.class); Set<Map.Entry<Grid2D.Coordinate, Fraction>> spawns = world.level.getElements(LevelElementType.spawn); for (Map.Entry<Grid2D.Coordinate, Fraction> e : spawns) { if (e.getValue() == world.viewer.fraction) { coordinates.add(e.getKey()); } } coordinates.shuffle(); int usedCount = Math.min(creatures.size, coordinates.size); Array<Creature> toPlace = Pools.obtain(Array.class); toPlace.addAll(creatures); toPlace.shuffle(); toPlace.truncate(usedCount); for (Creature creature : toPlace) { Grid2D.Coordinate coordinate = coordinates.pop(); place(creature, coordinate.x(), coordinate.y()); } toPlace.clear(); coordinates.clear(); Pools.free(toPlace); Pools.free(coordinates); }
Example 3
Source File: KeyMapper.java From riiablo with Apache License 2.0 | 5 votes |
@Override @NonNull public Iterator<MappedKey> iterator() { IntMap.Values<ObjectSet<MappedKey>> entries = KEYS.values(); ObjectSet<MappedKey> uniqueEntries = new ObjectSet<>(); for (ObjectSet<MappedKey> entry : entries) { uniqueEntries.addAll(entry); } return uniqueEntries.iterator(); }