diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-12-10 11:56:21 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-12-10 11:56:21 +0100 |
commit | 678fcad281202263a54e6a3028e0e2d5a1cef9c9 (patch) | |
tree | 3edf7a4d26510acc5a2b3adfe35168474d1bfca1 | |
parent | 75e8c19d31f4efb12acad0d2a9acfc66eb5d23dc (diff) | |
download | RustAndDust-678fcad281202263a54e6a3028e0e2d5a1cef9c9.zip RustAndDust-678fcad281202263a54e6a3028e0e2d5a1cef9c9.tar.gz |
add hud/Patch: to use NinePatch as background
-rw-r--r-- | core/src/ch/asynk/tankontank/game/hud/Patch.java | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/core/src/ch/asynk/tankontank/game/hud/Patch.java b/core/src/ch/asynk/tankontank/game/hud/Patch.java new file mode 100644 index 0000000..d5b6caa --- /dev/null +++ b/core/src/ch/asynk/tankontank/game/hud/Patch.java @@ -0,0 +1,28 @@ +package ch.asynk.tankontank.game.hud; + +import com.badlogic.gdx.graphics.g2d.Batch; +import com.badlogic.gdx.graphics.g2d.NinePatch; + +public class Patch extends Widget +{ + private NinePatch patch; + + public Patch(NinePatch patch) + { + super(); + this.patch = patch; + set(0, 0, patch.getTotalWidth(), patch.getTotalHeight()); + } + + @Override + public void dispose() + { + } + + @Override + public void draw(Batch batch) + { + if (!visible) return; + patch.draw(batch, rect.x, rect.y, rect.width, rect.height); + } +} |