From 6b46e61ecefb120b186247ac01c6e2afac6337bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Wed, 18 Dec 2019 09:56:48 +0100 Subject: UI : add Bg (TextureRegion) --- core/src/ch/asynk/gdx/boardgame/ui/Bg.java | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 core/src/ch/asynk/gdx/boardgame/ui/Bg.java diff --git a/core/src/ch/asynk/gdx/boardgame/ui/Bg.java b/core/src/ch/asynk/gdx/boardgame/ui/Bg.java new file mode 100644 index 0000000..18cfa7c --- /dev/null +++ b/core/src/ch/asynk/gdx/boardgame/ui/Bg.java @@ -0,0 +1,22 @@ +package ch.asynk.gdx.boardgame.ui; + +import com.badlogic.gdx.graphics.g2d.Batch; +import com.badlogic.gdx.graphics.g2d.TextureRegion; + +public class Bg extends Element +{ + private TextureRegion region; + + public Bg(TextureRegion region) + { + this.region = region; + rect.set(0, 0, region.getRegionWidth(), region.getRegionHeight()); + } + + @Override public void draw(Batch batch) + { + if (!visible) return; + if (tainted) computeGeometry(); + batch.draw(region, rect.x, rect.y, rect.width, rect.height); + } +} -- cgit v1.1-2-g2b99