diff options
Diffstat (limited to 'core/src/ch/asynk/tankontank')
| -rw-r--r-- | core/src/ch/asynk/tankontank/engine/gfx/animations/ShotAnimation.java | 27 | ||||
| -rw-r--r-- | core/src/ch/asynk/tankontank/engine/gfx/animations/Sprites.java | 31 | 
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]; +            } +        } +    } +} | 
