diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-15 17:24:18 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-15 17:24:18 +0200 |
commit | a043f7be9a33ec9f5aa57e18b1ae26878496720c (patch) | |
tree | 41f3fcc7c5c82d2ab68d01850031e84f82c7ecb3 /core/src/ch/asynk/tankontank/game/hud | |
parent | 68de02c5a844c260be3223541f19ba3c2e5c46d3 (diff) | |
download | RustAndDust-a043f7be9a33ec9f5aa57e18b1ae26878496720c.zip RustAndDust-a043f7be9a33ec9f5aa57e18b1ae26878496720c.tar.gz |
Bg: rect is protected
Diffstat (limited to 'core/src/ch/asynk/tankontank/game/hud')
-rw-r--r-- | core/src/ch/asynk/tankontank/game/hud/Bg.java | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/core/src/ch/asynk/tankontank/game/hud/Bg.java b/core/src/ch/asynk/tankontank/game/hud/Bg.java new file mode 100644 index 0000000..f862088 --- /dev/null +++ b/core/src/ch/asynk/tankontank/game/hud/Bg.java @@ -0,0 +1,51 @@ +package ch.asynk.tankontank.game.hud; + +import com.badlogic.gdx.utils.Disposable; +import com.badlogic.gdx.graphics.g2d.Batch; +import com.badlogic.gdx.graphics.g2d.TextureRegion; +import com.badlogic.gdx.graphics.glutils.ShapeRenderer; +import com.badlogic.gdx.math.Rectangle; + +import ch.asynk.tankontank.engine.gfx.Drawable; + +public class Bg implements Drawable, Disposable +{ + private TextureRegion region; + protected Rectangle rect; + + public Bg(TextureRegion region) + { + this.region = region; + this.rect = new Rectangle(0, 0, 0, 0); + } + + public void set(float x, float y, float w, float h) + { + rect.x = x; + rect.y = y; + rect.width = w; + rect.height = h; + } + + public boolean contains(float x, float y) + { + return rect.contains(x, y); + } + + @Override + public void dispose() + { + } + + @Override + public void draw(Batch batch) + { + batch.draw(region, rect.x, rect.y, rect.width, rect.height); + } + + @Override + public void drawDebug(ShapeRenderer shapes) + { + shapes.rect(rect.x, rect.y, rect.width, rect.height); + } +} |