Refine search
/** Removes from this array all of elements contained in the specified array. * @return true if this array was modified. */ public boolean removeAll (IntArray array) { int size = this.size; int startSize = size; int[] items = this.items; for (int i = 0, n = array.size; i < n; i++) { int item = array.get(i); for (int ii = 0; ii < size; ii++) { if (item == items[ii]) { removeIndex(ii); size--; break; } } } return size != startSize; }
/** Creates an animated tile with the given animation intervals and frame tiles. * * @param intervals The intervals between each individual frame tile in milliseconds. * @param frameTiles An array of {@link StaticTiledMapTile}s that make up the animation. */ public AnimatedTiledMapTile (IntArray intervals, Array<StaticTiledMapTile> frameTiles) { this.frameTiles = new StaticTiledMapTile[frameTiles.size]; this.frameCount = frameTiles.size; this.animationIntervals = intervals.toArray(); this.loopDuration = 0; for (int i = 0; i < intervals.size; ++i) { this.frameTiles[i] = frameTiles.get(i); this.loopDuration += intervals.get(i); } }
@Override public void load (AssetManager manager, ResourceData resources) { SaveData data = resources.getSaveData(); Array<IntArray> effectsIndices = data.load("indices"); AssetDescriptor descriptor; Iterator<IntArray> iterator = effectsIndices.iterator(); while ((descriptor = data.loadAsset()) != null) { ParticleEffect effect = (ParticleEffect)manager.get(descriptor); if (effect == null) throw new RuntimeException("Template is null"); Array<ParticleController> effectControllers = effect.getControllers(); IntArray effectIndices = iterator.next(); for (int i = 0, n = effectIndices.size; i < n; i++) { templates.add(effectControllers.get(effectIndices.get(i))); } } } }
cache.textures = textures.toArray(Texture.class); cache.counts = new int[cache.textureCount]; for (int i = 0, n = counts.size; i < n; i++) cache.counts[i] = counts.get(i); cache.textures[i] = textures.get(i); cache.counts[i] = counts.get(i); Cache lastCache = caches.get(caches.size - 1); vertices.limit(lastCache.offset + lastCache.maxCount); textures.clear(); counts.clear();
/** Adds the specified vertices to the cache. Each vertex should have 5 elements, one for each of the attributes: x, y, color, * u, and v. If indexed geometry is used, each image should be specified as 4 vertices, otherwise each image should be * specified as 6 vertices. */ public void add (Texture texture, float[] vertices, int offset, int length) { if (currentCache == null) throw new IllegalStateException("beginCache must be called before add."); int verticesPerImage = mesh.getNumIndices() > 0 ? 4 : 6; int count = length / (verticesPerImage * VERTEX_SIZE) * 6; int lastIndex = textures.size - 1; if (lastIndex < 0 || textures.get(lastIndex) != texture) { textures.add(texture); counts.add(count); } else counts.incr(lastIndex, count); mesh.getVerticesBuffer().put(vertices, offset, length); }
VertexAttribute attribute = attributes.get(i); int location = shader.getAttributeLocation(attribute.alias); stillValid = location == this.cachedLocations.get(i); stillValid = locations[i] == this.cachedLocations.get(i); Gdx.gl.glBindBuffer(GL20.GL_ARRAY_BUFFER, bufferHandle); unbindAttributes(shader); this.cachedLocations.clear(); this.cachedLocations.add(shader.getAttributeLocation(attribute.alias)); } else { this.cachedLocations.add(locations[i]); int location = this.cachedLocations.get(i); if (location < 0) { continue;
@Override public void stop () { ALSource source; for (int i = 0; i < streamIds.size; i++) { if ((source = getSoundSource(streamIds.get(i))) != null) source.stop(); } }
/** Sorts x,y pairs of values by the x value, then the y value. * @param count Number of indices, must be even. */ private void sort (float[] values, int count) { int lower = 0; int upper = count - 1; IntArray stack = quicksortStack; stack.add(lower); stack.add(upper - 1); while (stack.size > 0) { upper = stack.pop(); lower = stack.pop(); if (upper <= lower) continue; int i = quicksortPartition(values, lower, upper); if (i - lower > upper - i) { stack.add(lower); stack.add(i - 2); } stack.add(i + 2); stack.add(upper); if (upper - i >= i - lower) { stack.add(lower); stack.add(i - 2); } } }
vertexTypes.clear(); vertexTypes.ensureCapacity(vertexCount); for (int i = 0, n = vertexCount; i < n; ++i) vertexTypes.add(classifyVertex(i));
/** @see #IntArray(int[]) */ static public IntArray with (int... array) { return new IntArray(array); } }
float maxWidthLine = this.getWidth() - (style.background != null ? style.background.getLeftWidth() + style.background.getRightWidth() : 0); linesBreak.clear(); int lineStart = 0; int lastSpace = 0; lastCharacter = text.charAt(i); if (lastCharacter == ENTER_DESKTOP || lastCharacter == ENTER_ANDROID) { linesBreak.add(lineStart); linesBreak.add(i); lineStart = i + 1; } else { lastSpace = i - 1; linesBreak.add(lineStart); linesBreak.add(lastSpace + 1); lineStart = lastSpace + 1; lastSpace = lineStart; linesBreak.add(lineStart); linesBreak.add(text.length());
public synchronized boolean mouseMoved (int screenX, int screenY) { // Skip any queued mouse moved events. for (int i = next(MOUSE_MOVED, 0); i >= 0; i = next(MOUSE_MOVED, i + 5)) { queue.set(i, SKIP); queue.set(i + 3, 2); } queue.add(MOUSE_MOVED); queueTime(); queue.add(screenX); queue.add(screenY); return false; }