diff options
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); + } +} |