From c1afb49e5ab9f94f637205564637cf5a6895f065 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Sat, 20 Sep 2014 16:20:30 +0200 Subject: Animation extends Disposable --- core/src/ch/asynk/tankontank/engine/Layer.java | 4 ++-- core/src/ch/asynk/tankontank/engine/gfx/Animation.java | 6 +++--- .../asynk/tankontank/engine/gfx/animations/AnimationSequence.java | 4 ++-- .../asynk/tankontank/engine/gfx/animations/MoveToAnimation.java | 8 ++++---- .../asynk/tankontank/engine/gfx/animations/RunnableAnimation.java | 4 ++-- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/core/src/ch/asynk/tankontank/engine/Layer.java b/core/src/ch/asynk/tankontank/engine/Layer.java index d65f630..c0720c3 100644 --- a/core/src/ch/asynk/tankontank/engine/Layer.java +++ b/core/src/ch/asynk/tankontank/engine/Layer.java @@ -115,11 +115,11 @@ public class Layer nodes.clear(); for (int i = 0, n = animations.size(); i < n; i++) - animations.get(i).free(); + animations.get(i).dispose(); animations.clear(); for (int i = 0, n = nextAnimations.size(); i < n; i++) - nextAnimations.get(i).free(); + nextAnimations.get(i).dispose(); nextAnimations.clear(); batch.dispose(); diff --git a/core/src/ch/asynk/tankontank/engine/gfx/Animation.java b/core/src/ch/asynk/tankontank/engine/gfx/Animation.java index 6d79046..ca32857 100644 --- a/core/src/ch/asynk/tankontank/engine/gfx/Animation.java +++ b/core/src/ch/asynk/tankontank/engine/gfx/Animation.java @@ -1,10 +1,10 @@ package ch.asynk.tankontank.engine.gfx; -public interface Animation +import com.badlogic.gdx.utils.Disposable; + +public interface Animation extends Disposable { public Node getNode(); public boolean act(float delta); - - public void free(); } diff --git a/core/src/ch/asynk/tankontank/engine/gfx/animations/AnimationSequence.java b/core/src/ch/asynk/tankontank/engine/gfx/animations/AnimationSequence.java index 69a9c7a..a933ec1 100644 --- a/core/src/ch/asynk/tankontank/engine/gfx/animations/AnimationSequence.java +++ b/core/src/ch/asynk/tankontank/engine/gfx/animations/AnimationSequence.java @@ -33,12 +33,12 @@ public class AnimationSequence implements Animation, Pool.Poolable public void reset() { for (int i = 0, n = animations.size(); i < n; i++) - animations.get(i).free(); + animations.get(i).dispose(); animations.clear(); } @Override - public void free() + public void dispose() { animationSequencePool.free(this); } diff --git a/core/src/ch/asynk/tankontank/engine/gfx/animations/MoveToAnimation.java b/core/src/ch/asynk/tankontank/engine/gfx/animations/MoveToAnimation.java index d95e33a..54c3033 100644 --- a/core/src/ch/asynk/tankontank/engine/gfx/animations/MoveToAnimation.java +++ b/core/src/ch/asynk/tankontank/engine/gfx/animations/MoveToAnimation.java @@ -29,7 +29,7 @@ public class MoveToAnimation extends TimedAnimation } @Override - public void free() + public void dispose() { moveToAnimationPool.free(this); } @@ -61,14 +61,14 @@ public class MoveToAnimation extends TimedAnimation protected void end() { - free(); + dispose(); } protected void update(float percent) { if (percent == 1f) - node.setCoords(toX, toY, (int) toR); + node.setPosition(toX, toY, (int) toR); else - node.setCoords(fromX + ((toX - fromX) * percent), fromY + ((toY - fromY) * percent), (int) (fromR + ((toR - fromR) * percent))); + node.setPosition(fromX + ((toX - fromX) * percent), fromY + ((toY - fromY) * percent), (int) (fromR + ((toR - fromR) * percent))); } } diff --git a/core/src/ch/asynk/tankontank/engine/gfx/animations/RunnableAnimation.java b/core/src/ch/asynk/tankontank/engine/gfx/animations/RunnableAnimation.java index 5a4f235..bc6768c 100644 --- a/core/src/ch/asynk/tankontank/engine/gfx/animations/RunnableAnimation.java +++ b/core/src/ch/asynk/tankontank/engine/gfx/animations/RunnableAnimation.java @@ -31,7 +31,7 @@ public class RunnableAnimation implements Animation, Pool.Poolable } @Override - public void free() + public void dispose() { runnableAnimationPool.free(this); } @@ -50,7 +50,7 @@ public class RunnableAnimation implements Animation, Pool.Poolable runnable.run(); runnable = null; ran = true; - free(); + dispose(); return true; } -- cgit v1.1-2-g2b99