From bcdc8a5f3d3da465a8c555ee0bc2f606e0bb8502 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Sun, 21 Sep 2014 03:56:11 +0200 Subject: rename StackedSpriteNode -> StackedImages --- .../ch/asynk/tankontank/engine/TileOverlays.java | 6 +-- .../asynk/tankontank/engine/gfx/StackedImages.java | 58 ++++++++++++++++++++++ .../tankontank/engine/gfx/StackedSpriteNode.java | 58 ---------------------- 3 files changed, 61 insertions(+), 61 deletions(-) create mode 100644 core/src/ch/asynk/tankontank/engine/gfx/StackedImages.java delete mode 100644 core/src/ch/asynk/tankontank/engine/gfx/StackedSpriteNode.java diff --git a/core/src/ch/asynk/tankontank/engine/TileOverlays.java b/core/src/ch/asynk/tankontank/engine/TileOverlays.java index 8b2f750..48d755d 100644 --- a/core/src/ch/asynk/tankontank/engine/TileOverlays.java +++ b/core/src/ch/asynk/tankontank/engine/TileOverlays.java @@ -7,17 +7,17 @@ import com.badlogic.gdx.graphics.g2d.Batch; import com.badlogic.gdx.graphics.g2d.TextureAtlas; import com.badlogic.gdx.graphics.glutils.ShapeRenderer; -import ch.asynk.tankontank.engine.gfx.StackedSpriteNode; +import ch.asynk.tankontank.engine.gfx.StackedImages; public abstract class TileOverlays implements Tile { - private StackedSpriteNode overlays; + private StackedImages overlays; private ArrayDeque stack; public TileOverlays(TextureAtlas atlas) { this.stack = null; - this.overlays = new StackedSpriteNode(atlas); + this.overlays = new StackedImages(atlas); } @Override diff --git a/core/src/ch/asynk/tankontank/engine/gfx/StackedImages.java b/core/src/ch/asynk/tankontank/engine/gfx/StackedImages.java new file mode 100644 index 0000000..8e450ad --- /dev/null +++ b/core/src/ch/asynk/tankontank/engine/gfx/StackedImages.java @@ -0,0 +1,58 @@ +package ch.asynk.tankontank.engine.gfx; + +import com.badlogic.gdx.graphics.g2d.Sprite; +import com.badlogic.gdx.graphics.g2d.Batch; +import com.badlogic.gdx.graphics.g2d.TextureAtlas; +import com.badlogic.gdx.graphics.glutils.ShapeRenderer; +import com.badlogic.gdx.utils.Array; + +public class StackedImages implements BasicDrawable +{ + private boolean enabled[]; + private Array sprites; + + public StackedImages(TextureAtlas atlas) + { + this.sprites = atlas.createSprites(); + this.enabled = new boolean[sprites.size]; + } + + public void enable(int i, boolean enable) + { + enabled[i] = enable; + } + + public boolean isEnabled() + { + for (int i = 0; i < sprites.size; i++) + if (enabled[i]) return true; + return false; + } + + @Override + public void setPosition(float x, float y, float r) + { + for (int i = 0; i < sprites.size; i++) { + sprites.get(i).setPosition(x, y); + sprites.get(i).setRotation(r); + } + } + + @Override + public void draw(Batch batch, float parentAlpha) + { + for (int i = 0; i < sprites.size; i++) { + if (enabled[i]) + sprites.get(i).draw(batch, parentAlpha); + } + } + + @Override + public void drawDebug(ShapeRenderer shapes) + { + Sprite sprite = sprites.get(0); + float w = sprite.getWidth(); + float h = sprite.getHeight(); + shapes.rect(sprite.getX(), sprite.getY(), (w / 2f), (h / 2f), w, h, sprite.getScaleX(), sprite.getScaleY(), sprite.getRotation()); + } +} diff --git a/core/src/ch/asynk/tankontank/engine/gfx/StackedSpriteNode.java b/core/src/ch/asynk/tankontank/engine/gfx/StackedSpriteNode.java deleted file mode 100644 index 39baeca..0000000 --- a/core/src/ch/asynk/tankontank/engine/gfx/StackedSpriteNode.java +++ /dev/null @@ -1,58 +0,0 @@ -package ch.asynk.tankontank.engine.gfx; - -import com.badlogic.gdx.graphics.g2d.Sprite; -import com.badlogic.gdx.graphics.g2d.Batch; -import com.badlogic.gdx.graphics.g2d.TextureAtlas; -import com.badlogic.gdx.graphics.glutils.ShapeRenderer; -import com.badlogic.gdx.utils.Array; - -public class StackedSpriteNode implements BasicDrawable -{ - private boolean enabled[]; - private Array sprites; - - public StackedSpriteNode(TextureAtlas atlas) - { - this.sprites = atlas.createSprites(); - this.enabled = new boolean[sprites.size]; - } - - public void enable(int i, boolean enable) - { - enabled[i] = enable; - } - - public boolean isEnabled() - { - for (int i = 0; i < sprites.size; i++) - if (enabled[i]) return true; - return false; - } - - @Override - public void setPosition(float x, float y, float r) - { - for (int i = 0; i < sprites.size; i++) { - sprites.get(i).setPosition(x, y); - sprites.get(i).setRotation(r); - } - } - - @Override - public void draw(Batch batch, float parentAlpha) - { - for (int i = 0; i < sprites.size; i++) { - if (enabled[i]) - sprites.get(i).draw(batch, parentAlpha); - } - } - - @Override - public void drawDebug(ShapeRenderer shapes) - { - Sprite sprite = sprites.get(0); - float w = sprite.getWidth(); - float h = sprite.getHeight(); - shapes.rect(sprite.getX(), sprite.getY(), (w / 2f), (h / 2f), w, h, sprite.getScaleX(), sprite.getScaleY(), sprite.getRotation()); - } -} -- cgit v1.1-2-g2b99