Libgdx – Adding Hiero in Eclipse

In Libgdx you can’t simply display text like “Hello World” in Times New Roman, size 12 – you can only display bitmaps. Therefore in order to present the aforementioned phrase you have to display a bitmap with capital “H”, then lowercase “o” and so on, of the desired size and font.

But where to get such bitmaps from?

One of the solutions is to use a tool called Hiero:

hiero

You add it when installing Libgdx by ticking the “Tools”:

installing hiero

What happens if you have forgotten to tick it when installing Libgdx?

In Eclipse:

  1. Go to the main project folder (so the one without “-android”, “-desktop”, “-ios” or “-html”) and open “build.gradle” file.
  2. Find
dependencies

in section

project("desktop")
  1. Add
compile "com.badlogicgames.gdx:gdx-tools:$gdxVersion"
  1. Select all your projects -> Right-click -> Gradle -> Refresh All
  2. Run Hiero by right-clicking your desktop project -> Run As -> Java Application -> Hiero

This is it!

If you want to use LibGDX’s built-in dialogs you need to use the skins which require font file prepared already in e.g. .png format. For Ready Steady Teddy, my puzzle game I used Hiero to generate font files for this dialog:

hiero usage


←Table of contents
←My apps, games and other projects

Advertisements
Libgdx – Adding Hiero in Eclipse

One thought on “Libgdx – Adding Hiero in Eclipse

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s