summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-11-30 00:52:20 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2014-11-30 00:52:20 +0100
commitf24fb0260857f07f62fbe0a432009f7827b1b7eb (patch)
tree9cb8a66cfe8279053c43d63b1c9150426420eada /core/src/ch/asynk
parentd9cc3481d1f950bca53a1db8039dc5e9c08811d3 (diff)
downloadRustAndDust-f24fb0260857f07f62fbe0a432009f7827b1b7eb.zip
RustAndDust-f24fb0260857f07f62fbe0a432009f7827b1b7eb.tar.gz
extract Sprites form ShotAnimation
Diffstat (limited to 'core/src/ch/asynk')
-rw-r--r--core/src/ch/asynk/tankontank/engine/gfx/animations/ShotAnimation.java27
-rw-r--r--core/src/ch/asynk/tankontank/engine/gfx/animations/Sprites.java31
2 files changed, 31 insertions, 27 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/gfx/animations/ShotAnimation.java b/core/src/ch/asynk/tankontank/engine/gfx/animations/ShotAnimation.java
index 4a0130d..f8673df 100644
--- a/core/src/ch/asynk/tankontank/engine/gfx/animations/ShotAnimation.java
+++ b/core/src/ch/asynk/tankontank/engine/gfx/animations/ShotAnimation.java
@@ -14,33 +14,6 @@ import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import ch.asynk.tankontank.engine.gfx.Drawable;
import ch.asynk.tankontank.engine.gfx.Animation;
-class Sprites
-{
- public Texture texture;
- public TextureRegion[] frames;
- public final int width;
- public final int height;
- public final int cols;
- public final int rows;
-
- public Sprites(Texture texture, int cols, int rows)
- {
- this.cols = cols;
- this.rows = rows;
- this.width = (texture.getWidth() / cols);
- this.height = (texture.getHeight() / rows);
- this.texture = texture;
- TextureRegion[][] tmp = TextureRegion.split(texture, width, height);
- frames = new TextureRegion[cols * rows];
- int idx = 0;
- for (int i = 0; i < rows; i++) {
- for (int j = 0; j < cols; j++) {
- frames[idx++] = tmp[i][j];
- }
- }
- }
-}
-
public class ShotAnimation implements Disposable, Animation, Pool.Poolable
{
private static final float SHOT_SCATTERING = 60f;
diff --git a/core/src/ch/asynk/tankontank/engine/gfx/animations/Sprites.java b/core/src/ch/asynk/tankontank/engine/gfx/animations/Sprites.java
new file mode 100644
index 0000000..8418965
--- /dev/null
+++ b/core/src/ch/asynk/tankontank/engine/gfx/animations/Sprites.java
@@ -0,0 +1,31 @@
+package ch.asynk.tankontank.engine.gfx.animations;
+
+import com.badlogic.gdx.graphics.Texture;
+import com.badlogic.gdx.graphics.g2d.TextureRegion;
+
+public class Sprites
+{
+ public Texture texture;
+ public TextureRegion[] frames;
+ public final int width;
+ public final int height;
+ public final int cols;
+ public final int rows;
+
+ public Sprites(Texture texture, int cols, int rows)
+ {
+ this.cols = cols;
+ this.rows = rows;
+ this.width = (texture.getWidth() / cols);
+ this.height = (texture.getHeight() / rows);
+ this.texture = texture;
+ TextureRegion[][] tmp = TextureRegion.split(texture, width, height);
+ frames = new TextureRegion[cols * rows];
+ int idx = 0;
+ for (int i = 0; i < rows; i++) {
+ for (int j = 0; j < cols; j++) {
+ frames[idx++] = tmp[i][j];
+ }
+ }
+ }
+}