@Override public void free (T object) { obtained.removeValue(object, true); super.free(object); }
/** Removes all actors and cells from the table. */ public void clearChildren () { Array<Cell> cells = this.cells; for (int i = cells.size - 1; i >= 0; i--) { Cell cell = cells.get(i); Actor actor = cell.actor; if (actor != null) actor.remove(); } cellPool.freeAll(cells); cells.clear(); rows = 0; columns = 0; if (rowDefaults != null) cellPool.free(rowDefaults); rowDefaults = null; implicitEndRow = false; super.clearChildren(); }
/** Queue an animation to be applied when the current is finished. If current is continuous it will be synced on next loop. */ protected AnimationDesc queue (final AnimationDesc anim, float transitionTime) { if (current == null || current.loopCount == 0) animate(anim, transitionTime); else { if (queued != null) animationPool.free(queued); queued = anim; queuedTransitionTime = transitionTime; if (current.loopCount < 0) current.loopCount = 1; } return anim; }
/** delete the native object if required and allow the instance to be reused by the obtain method */ public static void free(final btBroadphaseProxy inst) { inst.dispose(); pool.free(inst); }
/** Queue an animation to be applied when the current is finished. If current is continuous it will be synced on next loop. */ protected AnimationDesc queue (final AnimationDesc anim, float transitionTime) { if (current == null || current.loopCount == 0) animate(anim, transitionTime); else { if (queued != null) animationPool.free(queued); queued = anim; queuedTransitionTime = transitionTime; if (current.loopCount < 0) current.loopCount = 1; } return anim; }
/** delete the native object if required and allow the instance to be reused by the obtain method */ public static void free(final btBroadphaseProxy inst) { inst.dispose(); pool.free(inst); }
/** delete the native object if required and allow the instance to be reused by the obtain method */ public static void free(final btBroadphasePair inst) { inst.dispose(); pool.free(inst); }
/** Frees an object from the {@link #get(Class) pool}. */ static public void free (Object object) { if (object == null) throw new IllegalArgumentException("Object cannot be null."); Pool pool = typePools.get(object.getClass()); if (pool == null) return; // Ignore freeing an object that was never retained. pool.free(object); }
/** delete the native object if required and allow the instance to be reused by the obtain method */ public static void free(final btBroadphasePair inst) { inst.dispose(); pool.free(inst); }
@Override public void free (T object) { obtained.removeValue(object, true); super.free(object); }
/** Frees an object from the {@link #get(Class) pool}. */ static public void free (Object object) { if (object == null) throw new IllegalArgumentException("Object cannot be null."); Pool pool = typePools.get(object.getClass()); if (pool == null) return; // Ignore freeing an object that was never retained. pool.free(object); }
/** Set the active animation, replacing any current animation. */ protected AnimationDesc setAnimation (final AnimationDesc anim) { if (current == null) current = anim; else { if (!allowSameAnimation && anim != null && current.animation == anim.animation) anim.time = current.time; else removeAnimation(current.animation); animationPool.free(current); current = anim; } justChangedAnimation = true; return anim; }
/** Set the active animation, replacing any current animation. */ protected AnimationDesc setAnimation (final AnimationDesc anim) { if (current == null) current = anim; else { if (!allowSameAnimation && anim != null && current.animation == anim.animation) anim.time = current.time; else removeAnimation(current.animation); animationPool.free(current); current = anim; } justChangedAnimation = true; return anim; }
/** Resets this body after fetching it from the {@link World#freeBodies} Pool. */ protected void reset (long addr) { this.addr = addr; this.userData = null; for (int i = 0; i < fixtures.size; i++) this.world.freeFixtures.free(fixtures.get(i)); fixtures.clear(); this.joints.clear(); }
/** Destroy a fixture. This removes the fixture from the broad-phase and destroys all contacts associated with this fixture. * This will automatically adjust the mass of the body if the body is dynamic and the fixture has positive density. All * fixtures attached to a body are implicitly destroyed when the body is destroyed. * @param fixture the fixture to be removed. * @warning This function is locked during callbacks. */ public void destroyFixture (Fixture fixture) { this.world.destroyFixture(this, fixture); fixture.setUserData(null); this.world.fixtures.remove(fixture.addr); this.fixtures.removeValue(fixture, true); this.world.freeFixtures.free(fixture); }
/** End applying multiple animations to the instance and update it to reflect the changes. */ protected void end () { if (!applying) throw new GdxRuntimeException("You must call begin() first"); for (Entry<Node, Transform> entry : transforms.entries()) { entry.value.toMatrix4(entry.key.localTransform); transformPool.free(entry.value); } transforms.clear(); target.calculateTransforms(); applying = false; }
/** End applying multiple animations to the instance and update it to reflect the changes. */ protected void end () { if (!applying) throw new GdxRuntimeException("You must call begin() first"); for (Entry<Node, Transform> entry : transforms.entries()) { entry.value.toMatrix4(entry.key.localTransform); transformPool.free(entry.value); } transforms.clear(); target.calculateTransforms(); applying = false; }
/** Indicates that subsequent cells should be added to a new row and returns the cell values that will be used as the defaults * for all cells in the new row. */ public Cell row () { if (cells.size > 0) { if (!implicitEndRow) { if (cells.peek().endRow) return rowDefaults; // Row was already ended. endRow(); } invalidate(); } implicitEndRow = false; if (rowDefaults != null) cellPool.free(rowDefaults); rowDefaults = obtainCell(); rowDefaults.clear(); return rowDefaults; }
public void renderSkeleton (final Vector3 from, final Node node) { final Vector3 pos = vectorPool.obtain(); node.globalTransform.getTranslation(pos); shapeRenderer.setColor(node.isAnimated ? Color.RED : Color.YELLOW); shapeRenderer.box(pos.x, pos.y, pos.z, 0.5f, 0.5f, 0.5f); shapeRenderer.setColor(Color.WHITE); shapeRenderer.line(from.x, from.y, from.z, pos.x, pos.y, pos.z); for (Node child : node.getChildren()) renderSkeleton(pos, child); vectorPool.free(pos); }
public void free (PooledEffect effect) { super.free(effect); effect.reset(false); // copy parameters exactly to avoid introducing error if (effect.xSizeScale != this.effect.xSizeScale || effect.ySizeScale != this.effect.ySizeScale || effect.motionScale != this.effect.motionScale){ Array<ParticleEmitter> emitters = effect.getEmitters(); Array<ParticleEmitter> templateEmitters = this.effect.getEmitters(); for (int i=0; i<emitters.size; i++){ ParticleEmitter emitter = emitters.get(i); ParticleEmitter templateEmitter = templateEmitters.get(i); emitter.matchSize(templateEmitter); emitter.matchMotion(templateEmitter); } effect.xSizeScale = this.effect.xSizeScale; effect.ySizeScale = this.effect.ySizeScale; effect.motionScale = this.effect.motionScale; } }