List of usage examples for com.badlogic.gdx.utils SnapshotArray SnapshotArray
public SnapshotArray()
From source file:com.badlogic.ashley.core.signals.Signal.java
License:Apache License
public Signal() { listeners = new SnapshotArray<Listener<T>>(); }
From source file:com.jmolina.orb.situations.Situation.java
License:Open Source License
/** * Constructor/*from w w w. j a va 2s.co m*/ * * @param am AssetManager * @param world Mundo fisico * @param pixelsPerMeter Factor de correcion pixeles/metros */ public Situation(AssetManager am, World world, float pixelsPerMeter) { this.pixelsPerMeter = pixelsPerMeter; this.world = world; assetManager = am; elements = new SnapshotArray<Element>(); positionY = 0; createElements(); }
From source file:es.eucm.ead.editor.control.Commands.java
License:Open Source License
/** * /* w ww.ja v a2 s .com*/ * @param model * the game project model */ public Commands(Model model) { this.model = model; commandListeners = new SnapshotArray<CommandListener>(); this.commandsStacks = new Stack<CommandsStack>(); pushStack(); }
From source file:es.eucm.ead.engine.collision.BoundingAreaBuilder.java
License:Open Source License
private static Polygon getBoundingPolygon(EngineEntity entity, Group sceneContentGroup, Group group) { SnapshotArray<Vector2> allPoints = new SnapshotArray<Vector2>(); for (Polygon polygon : getColliders(entity)) { for (int i = 0; i < polygon.getVertices().length; i += 2) { Vector2 tmp = Pools.obtain(Vector2.class); tmp.set(polygon.getVertices()[i], polygon.getVertices()[i + 1]); group.localToAscendantCoordinates(sceneContentGroup, tmp); allPoints.add(tmp);/*from ww w .j a v a 2s . c o m*/ } } if (allPoints.size == 0) { return null; } // Remove duplicates, if any. Algorithm works better this way Object[] pointsToIterate = allPoints.begin(); int size = allPoints.size; for (int i = 0; i < size; i++) { Vector2 pointA = (Vector2) pointsToIterate[i]; for (int j = 0; j < size; j++) { Vector2 pointB = (Vector2) pointsToIterate[j]; if (j != i && pointA.equals(pointB)) { allPoints.removeValue(pointB, true); } } } allPoints.end(); // To array float[] points = toSimpleArray(allPoints); FloatArray floatArray = convexHull.computePolygon(points, false); // Remove the last point, since its the first one (duplicate) floatArray.removeRange(floatArray.size - 2, floatArray.size - 1); Polygon polygon = new Polygon(); polygon.setVertices(floatArray.toArray()); return polygon; }