From 178fbdbf4ce1e37f4db179a0de14ae19b01923d2 Mon Sep 17 00:00:00 2001 From: Jérémy Zurcher Date: Thu, 17 Dec 2015 13:58:02 +0100 Subject: Game: Factory knows about regions and provide them --- core/src/ch/asynk/rustanddust/engine/HeadedPawn.java | 8 ++++---- core/src/ch/asynk/rustanddust/engine/Pawn.java | 5 +++-- .../asynk/rustanddust/engine/gfx/animations/PromoteAnimation.java | 6 +++--- 3 files changed, 10 insertions(+), 9 deletions(-) (limited to 'core/src/ch/asynk/rustanddust/engine') diff --git a/core/src/ch/asynk/rustanddust/engine/HeadedPawn.java b/core/src/ch/asynk/rustanddust/engine/HeadedPawn.java index f60e38ed..073f227f 100644 --- a/core/src/ch/asynk/rustanddust/engine/HeadedPawn.java +++ b/core/src/ch/asynk/rustanddust/engine/HeadedPawn.java @@ -3,7 +3,7 @@ package ch.asynk.rustanddust.engine; import com.badlogic.gdx.graphics.g2d.Batch; import com.badlogic.gdx.graphics.g2d.Sprite; import com.badlogic.gdx.graphics.g2d.TextureAtlas; -import com.badlogic.gdx.graphics.g2d.TextureRegion; +import com.badlogic.gdx.graphics.g2d.TextureAtlas.AtlasRegion; import com.badlogic.gdx.graphics.glutils.ShapeRenderer; import com.badlogic.gdx.math.Vector3; @@ -19,10 +19,10 @@ public abstract class HeadedPawn extends Pawn this.orientation = Orientation.KEEP; } - public HeadedPawn(Faction faction, String pawn, String head, TextureAtlas pawns, TextureAtlas overlays) + public HeadedPawn(Faction faction, AtlasRegion body, AtlasRegion head, TextureAtlas overlays) { - super(faction, pawn, pawns, overlays); - this.head = new Sprite(pawns.findRegion(head)); + super(faction, body, overlays); + this.head = new Sprite(head); this.orientation = Orientation.KEEP; this.descr += " " + orientation; } diff --git a/core/src/ch/asynk/rustanddust/engine/Pawn.java b/core/src/ch/asynk/rustanddust/engine/Pawn.java index 43de4f47..ce5fb58a 100644 --- a/core/src/ch/asynk/rustanddust/engine/Pawn.java +++ b/core/src/ch/asynk/rustanddust/engine/Pawn.java @@ -7,6 +7,7 @@ import com.badlogic.gdx.utils.Disposable; import com.badlogic.gdx.graphics.g2d.Batch; import com.badlogic.gdx.graphics.g2d.Sprite; import com.badlogic.gdx.graphics.g2d.TextureAtlas; +import com.badlogic.gdx.graphics.g2d.TextureAtlas.AtlasRegion; import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.graphics.glutils.ShapeRenderer; @@ -78,12 +79,12 @@ public abstract class Pawn implements Moveable, Disposable this.attack = new Attack(this); } - public Pawn(Faction faction, String name, TextureAtlas pawns, TextureAtlas overlays) + public Pawn(Faction faction, AtlasRegion body, TextureAtlas overlays) { this(); this.faction = faction; this.descr = descr; - this.sprite = new Sprite(pawns.findRegion(name)); + this.sprite = new Sprite(body); this.overlays = new StackedImages(overlays); } diff --git a/core/src/ch/asynk/rustanddust/engine/gfx/animations/PromoteAnimation.java b/core/src/ch/asynk/rustanddust/engine/gfx/animations/PromoteAnimation.java index 24eac184..e054acb2 100644 --- a/core/src/ch/asynk/rustanddust/engine/gfx/animations/PromoteAnimation.java +++ b/core/src/ch/asynk/rustanddust/engine/gfx/animations/PromoteAnimation.java @@ -3,7 +3,7 @@ package ch.asynk.rustanddust.engine.gfx.animations; import java.lang.Math; import com.badlogic.gdx.audio.Sound; -import com.badlogic.gdx.graphics.g2d.TextureAtlas; +import com.badlogic.gdx.graphics.g2d.TextureAtlas.AtlasRegion; import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.graphics.g2d.Batch; import com.badlogic.gdx.graphics.glutils.ShapeRenderer; @@ -32,9 +32,9 @@ public class PromoteAnimation implements Animation, Drawable private float volume; private float elapsed; - public static void init(TextureAtlas atlas, Sound usSnd, Sound geSnd) + public static void init(AtlasRegion r, Sound usSnd, Sound geSnd) { - region = atlas.findRegion("stars"); + region = r; usSound = usSnd; geSound = geSnd; } -- cgit v1.2.3