diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2016-05-18 22:48:22 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2016-05-18 22:48:22 +0200 |
commit | a8110d8675c0fdec2a486e8020747e4a5d4273b7 (patch) | |
tree | bdece8b51b7ccac3b99b98262575ccb2d3c634a5 | |
parent | 72d8e81622e5fa396a61e1309e0c965a05af58ad (diff) | |
download | RustAndDust-a8110d8675c0fdec2a486e8020747e4a5d4273b7.zip RustAndDust-a8110d8675c0fdec2a486e8020747e4a5d4273b7.tar.gz |
LabelStack: uses IterableQueue
-rw-r--r-- | core/src/ch/asynk/rustanddust/ui/LabelStack.java | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/core/src/ch/asynk/rustanddust/ui/LabelStack.java b/core/src/ch/asynk/rustanddust/ui/LabelStack.java index b534f45..9ab0768 100644 --- a/core/src/ch/asynk/rustanddust/ui/LabelStack.java +++ b/core/src/ch/asynk/rustanddust/ui/LabelStack.java @@ -1,9 +1,8 @@ package ch.asynk.rustanddust.ui; -import java.util.ArrayDeque; - import com.badlogic.gdx.graphics.g2d.BitmapFont; +import ch.asynk.rustanddust.engine.util.IterableQueue; import ch.asynk.rustanddust.engine.gfx.Animation; public class LabelStack extends Label implements Animation @@ -23,19 +22,19 @@ public class LabelStack extends Label implements Animation private float duration; private float elapsed; - private ArrayDeque<MsgInfo> stack; + private IterableQueue<MsgInfo> queue; public LabelStack(BitmapFont font, float padding) { super(font, padding); this.visible = false; - this.stack = new ArrayDeque<MsgInfo>(); + this.queue = new IterableQueue<MsgInfo>(3); } public void pushWrite(String text, float duration, Position position) { if (visible) - stack.push(new MsgInfo(text, duration, position)); + queue.enqueue(new MsgInfo(text, duration, position)); else write(text, duration, position); } @@ -61,8 +60,8 @@ public class LabelStack extends Label implements Animation elapsed += delta; if (elapsed >= duration) { visible = false; - if (stack.size() > 0) { - MsgInfo info = stack.pop(); + if (queue.size() > 0) { + MsgInfo info = queue.dequeue(); write(info.text, info.duration, info.position); return true; } |