summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/tankontank/game/hud
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-11-08 12:17:36 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2014-11-08 12:17:36 +0100
commit32c5cbffbb829bf1a8b0aae9bb022ccf0964bf18 (patch)
treef93615c86e7c5860daea524a4d4684995e73b786 /core/src/ch/asynk/tankontank/game/hud
parentf71f31fc26f1e7898c3ce3a8a4bba7e9f5072106 (diff)
downloadRustAndDust-32c5cbffbb829bf1a8b0aae9bb022ccf0964bf18.zip
RustAndDust-32c5cbffbb829bf1a8b0aae9bb022ccf0964bf18.tar.gz
game/hud: Text*.java -> Label*.java
Diffstat (limited to 'core/src/ch/asynk/tankontank/game/hud')
-rw-r--r--core/src/ch/asynk/tankontank/game/hud/Dialog.java16
-rw-r--r--core/src/ch/asynk/tankontank/game/hud/Label.java (renamed from core/src/ch/asynk/tankontank/game/hud/Text.java)4
-rw-r--r--core/src/ch/asynk/tankontank/game/hud/LabelButton.java (renamed from core/src/ch/asynk/tankontank/game/hud/TextButton.java)20
-rw-r--r--core/src/ch/asynk/tankontank/game/hud/LabelImage.java (renamed from core/src/ch/asynk/tankontank/game/hud/TextImage.java)20
4 files changed, 31 insertions, 29 deletions
diff --git a/core/src/ch/asynk/tankontank/game/hud/Dialog.java b/core/src/ch/asynk/tankontank/game/hud/Dialog.java
index 006c18a..ee9c62c 100644
--- a/core/src/ch/asynk/tankontank/game/hud/Dialog.java
+++ b/core/src/ch/asynk/tankontank/game/hud/Dialog.java
@@ -13,14 +13,14 @@ public class Dialog extends Bg
public boolean visible;
public boolean ok;
public int padding;
- private Text text;
+ private Label label;
private Image okBtn;
private Image cancelBtn;
public Dialog(BitmapFont font, TextureRegion region, TextureAtlas atlas)
{
super(region);
- this.text = new Text(font, "hello");
+ this.label = new Label(font, "hello");
this.okBtn = new Image(atlas.findRegion("ok"));
this.cancelBtn = new Image(atlas.findRegion("cancel"));
this.visible = false;
@@ -29,8 +29,8 @@ public class Dialog extends Bg
public void show(String msg, Position position)
{
- text.write(msg);
- TextBounds b = text.getBounds();
+ label.write(msg);
+ TextBounds b = label.getBounds();
float height = (b.height + (3 * padding) + okBtn.getHeight());
float width = (b.width + (2 * padding));
@@ -42,7 +42,7 @@ public class Dialog extends Bg
set(x, y, width, height);
okBtn.setPosition((x + width - okBtn.getWidth() - padding), (y + padding));
cancelBtn.setPosition((okBtn.getX() - cancelBtn.getWidth() - padding), okBtn.getY());
- text.setPosition((x + padding), (y + okBtn.getHeight() + padding));
+ label.setPosition((x + padding), (y + okBtn.getHeight() + padding));
visible = true;
ok = false;
}
@@ -63,7 +63,9 @@ public class Dialog extends Bg
public void dispose()
{
super.dispose();
- // font.dispose();
+ label.dispose();
+ okBtn.dispose();
+ cancelBtn.dispose();
}
@Override
@@ -71,7 +73,7 @@ public class Dialog extends Bg
{
if (!visible) return;
super.draw(batch);
- text.draw(batch);
+ label.draw(batch);
okBtn.draw(batch);
cancelBtn.draw(batch);
}
diff --git a/core/src/ch/asynk/tankontank/game/hud/Text.java b/core/src/ch/asynk/tankontank/game/hud/Label.java
index 99f07bd..a0ada50 100644
--- a/core/src/ch/asynk/tankontank/game/hud/Text.java
+++ b/core/src/ch/asynk/tankontank/game/hud/Label.java
@@ -8,7 +8,7 @@ import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import ch.asynk.tankontank.engine.gfx.Drawable;
-public class Text implements Drawable, Disposable
+public class Label implements Drawable, Disposable
{
public boolean visible;
public float x;
@@ -17,7 +17,7 @@ public class Text implements Drawable, Disposable
private String text;
private BitmapFont font;
- public Text(BitmapFont font, String text)
+ public Label(BitmapFont font, String text)
{
this.font = font;
this.text = text;
diff --git a/core/src/ch/asynk/tankontank/game/hud/TextButton.java b/core/src/ch/asynk/tankontank/game/hud/LabelButton.java
index 158a2b0..e63efc1 100644
--- a/core/src/ch/asynk/tankontank/game/hud/TextButton.java
+++ b/core/src/ch/asynk/tankontank/game/hud/LabelButton.java
@@ -4,37 +4,37 @@ import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
-public class TextButton extends Button
+public class LabelButton extends Button
{
- private Text text;
+ private Label label;
- public TextButton(TextureAtlas atlas, String base, BitmapFont font, String text)
+ public LabelButton(TextureAtlas atlas, String base, BitmapFont font, String text)
{
super(atlas, base);
- this.text = new Text(font, text);
+ this.label = new Label(font, text);
}
@Override
public void dispose()
{
super.dispose();
- text.dispose();
+ label.dispose();
}
public void setPosition(float x, float y)
{
super.setPosition(x, y);
- setTextPosition((x + ((getWidth() - text.getWidth()) / 2)), (y + ((getHeight() - text.getHeight()) / 2)));
+ setLabelPosition((x + ((getWidth() - label.getWidth()) / 2)), (y + ((getHeight() - label.getHeight()) / 2)));
}
- public void setTextPosition(float x, float y)
+ public void setLabelPosition(float x, float y)
{
- text.setPosition(x, y);
+ label.setPosition(x, y);
}
public void write(String text)
{
- this.text.write(text);
+ this.label.write(text);
}
@Override
@@ -42,6 +42,6 @@ public class TextButton extends Button
{
if (!visible) return;
super.draw(batch);
- text.draw(batch);
+ label.draw(batch);
}
}
diff --git a/core/src/ch/asynk/tankontank/game/hud/TextImage.java b/core/src/ch/asynk/tankontank/game/hud/LabelImage.java
index f16f992..4eb14c7 100644
--- a/core/src/ch/asynk/tankontank/game/hud/TextImage.java
+++ b/core/src/ch/asynk/tankontank/game/hud/LabelImage.java
@@ -6,37 +6,37 @@ import com.badlogic.gdx.graphics.g2d.TextureRegion;
import ch.asynk.tankontank.engine.gfx.Image;
-public class TextImage extends Image
+public class LabelImage extends Image
{
- private Text text;
+ private Label label;
- public TextImage(TextureRegion region, BitmapFont font, String text)
+ public LabelImage(TextureRegion region, BitmapFont font, String text)
{
super(region);
- this.text = new Text(font, text);
+ this.label = new Label(font, text);
}
@Override
public void dispose()
{
super.dispose();
- text.dispose();
+ label.dispose();
}
public void setPosition(float x, float y)
{
super.setPosition(x, y);
- setTextPosition((x + ((getWidth() - text.getWidth()) / 2)), (y + ((getHeight() - text.getHeight()) / 2)));
+ setLabelPosition((x + ((getWidth() - label.getWidth()) / 2)), (y + ((getHeight() - label.getHeight()) / 2)));
}
- public void setTextPosition(float x, float y)
+ public void setLabelPosition(float x, float y)
{
- text.setPosition(x, y);
+ label.setPosition(x, y);
}
public void write(String text)
{
- this.text.write(text);
+ this.label.write(text);
}
@Override
@@ -44,6 +44,6 @@ public class TextImage extends Image
{
if (!visible) return;
super.draw(batch);
- text.draw(batch);
+ label.draw(batch);
}
}