From 3bfd070fdc21812b2ffb8d29503a9597e0fa14ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Wed, 17 Dec 2014 16:16:01 +0100 Subject: remove Button --- core/src/ch/asynk/tankontank/game/hud/Button.java | 82 ----------------------- 1 file changed, 82 deletions(-) delete mode 100644 core/src/ch/asynk/tankontank/game/hud/Button.java diff --git a/core/src/ch/asynk/tankontank/game/hud/Button.java b/core/src/ch/asynk/tankontank/game/hud/Button.java deleted file mode 100644 index 9156d50..0000000 --- a/core/src/ch/asynk/tankontank/game/hud/Button.java +++ /dev/null @@ -1,82 +0,0 @@ -package ch.asynk.tankontank.game.hud; - -import com.badlogic.gdx.graphics.g2d.Batch; -import com.badlogic.gdx.graphics.g2d.TextureAtlas; -import com.badlogic.gdx.graphics.g2d.TextureRegion; - -public class Button extends Widget -{ - private int idx; - private TextureRegion regions []; - private TextureRegion region; - - private static final int UP = 0; - private static final int DOWN = 1; - private static final int ON = 2; - - public Button(TextureAtlas atlas, String base) - { - this.idx = UP; - this.regions = new TextureRegion[3]; - this.regions[UP] = atlas.findRegion(base + "-up"); - this.regions[DOWN] = atlas.findRegion(base + "-down"); - this.regions[ON] = atlas.findRegion(base + "-on"); - // assumes they all have the same dimension - rect.width = regions[idx].getRegionWidth(); - rect.height = regions[idx].getRegionHeight(); - } - - @Override - public void dispose() - { - } - - public void hide() - { - setUp(); - visible = false; - } - - public void setUp() - { - idx = UP; - } - - public void setDown() - { - idx = DOWN; - } - - public void setOn() - { - idx = ON; - } - - public boolean isUp() - { - return (idx == UP); - } - - public boolean isDown() - { - return (idx == DOWN); - } - - public boolean isOn() - { - return (idx == ON); - } - - public boolean hit(float x, float y) - { - if (idx == ON) return false; - return super.hit(x,y); - } - - @Override - public void draw(Batch batch) - { - if (!visible) return; - batch.draw(regions[idx], rect.x, rect.y, rect.width, rect.height); - } -} -- cgit v1.1-2-g2b99