From 678fcad281202263a54e6a3028e0e2d5a1cef9c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Wed, 10 Dec 2014 11:56:21 +0100 Subject: add hud/Patch: to use NinePatch as background --- core/src/ch/asynk/tankontank/game/hud/Patch.java | 28 ++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 core/src/ch/asynk/tankontank/game/hud/Patch.java 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); + } +} -- cgit v1.1-2-g2b99