diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2018-06-27 10:13:39 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2018-06-28 16:25:07 +0200 |
commit | 357bb12eef425ae91a1055f60f788a450f965fb0 (patch) | |
tree | 6b4ee449662a8c36174e48f777f6886ee2917733 /core/src/ch/asynk/zproject/Hud.java | |
parent | 1e5fc3262942078fe00d51c2f2c9a241bd01a582 (diff) | |
download | gdx-boardgame-357bb12eef425ae91a1055f60f788a450f965fb0.zip gdx-boardgame-357bb12eef425ae91a1055f60f788a450f965fb0.tar.gz |
Assets supports TrueType fonts
Diffstat (limited to 'core/src/ch/asynk/zproject/Hud.java')
-rw-r--r-- | core/src/ch/asynk/zproject/Hud.java | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/core/src/ch/asynk/zproject/Hud.java b/core/src/ch/asynk/zproject/Hud.java index 38728c0..4614cd4 100644 --- a/core/src/ch/asynk/zproject/Hud.java +++ b/core/src/ch/asynk/zproject/Hud.java @@ -1,7 +1,9 @@ package ch.asynk.zproject; -import com.badlogic.gdx.graphics.g2d.SpriteBatch; +import com.badlogic.gdx.graphics.g2d.BitmapFont; +import com.badlogic.gdx.graphics.g2d.GlyphLayout; import com.badlogic.gdx.graphics.g2d.Sprite; +import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.math.Rectangle; import com.badlogic.gdx.utils.Disposable; @@ -9,10 +11,16 @@ import com.badlogic.gdx.utils.Disposable; public class Hud implements Disposable { private final Sprite hud; + private final GlyphLayout glyphLayout; + private final BitmapFont font20; + private final BitmapFont font25; public Hud(final Assets assets) { this.hud = new Sprite(assets.getTexture(assets.CORNER)); + this.glyphLayout = new GlyphLayout(); + font20 = assets.getFont(assets.FONT_20); + font25 = assets.getFont(assets.FONT_25); } @Override public void dispose() @@ -36,5 +44,9 @@ public class Hud implements Disposable hud.setPosition(right, top); hud.setRotation(270); hud.draw(batch); + glyphLayout.setText(font20, "Hello"); + font20.draw(batch, glyphLayout, 60, 30); + glyphLayout.setText(font25, "worlD"); + font25.draw(batch, glyphLayout, 120, 32); } } |