diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2018-06-28 16:24:06 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2018-06-28 16:24:06 +0200 |
commit | afa5db087cb0fc28223712cfc4ac4612504bdd69 (patch) | |
tree | 8575070b58c49ecae2f1a43fb0dae919f2df4c3d /core/src/ch/asynk/zproject/Hud.java | |
parent | dd3232a74ab4b5f0d353d717cf3f080a73528a6e (diff) | |
download | gdx-boardgame-afa5db087cb0fc28223712cfc4ac4612504bdd69.zip gdx-boardgame-afa5db087cb0fc28223712cfc4ac4612504bdd69.tar.gz |
implement GameScreen and GameCamera
Diffstat (limited to 'core/src/ch/asynk/zproject/Hud.java')
-rw-r--r-- | core/src/ch/asynk/zproject/Hud.java | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/core/src/ch/asynk/zproject/Hud.java b/core/src/ch/asynk/zproject/Hud.java new file mode 100644 index 0000000..ded7981 --- /dev/null +++ b/core/src/ch/asynk/zproject/Hud.java @@ -0,0 +1,40 @@ +package ch.asynk.zproject; + +import com.badlogic.gdx.graphics.g2d.SpriteBatch; +import com.badlogic.gdx.graphics.g2d.Sprite; +import com.badlogic.gdx.graphics.Texture; +import com.badlogic.gdx.math.Rectangle; +import com.badlogic.gdx.utils.Disposable; + +public class Hud implements Disposable +{ + private final Sprite hud; + + public Hud() + { + this.hud = new Sprite(new Texture("data/corner.png")); + } + + @Override public void dispose() + { + hud.getTexture().dispose(); + } + + public void draw(SpriteBatch batch, final Rectangle rect) + { + float right = rect.x + rect.width - hud.getWidth(); + float top = rect.y + rect.height - hud.getHeight(); + hud.setRotation(0); + hud.setPosition(rect.x, top); + hud.draw(batch); + hud.setRotation(90); + hud.setPosition(rect.x, rect.y); + hud.draw(batch); + hud.setRotation(180); + hud.setPosition(right, rect.y); + hud.draw(batch); + hud.setPosition(right, top); + hud.setRotation(270); + hud.draw(batch); + } +} |