viernes, 14 de junio de 2013

Fonts, text, transitions, buttons & Android

The development was fairly boring this week, but had to be done. Fonts aren't glamorous, but they are needed. I've found that i like a more spartan look to the UI of my games (like Skyrim). So, i've decided to settle on a simple UI without much clutter and let the game be the "filler".

Fonts in LibGDX

Using fonts in LibGDX is very straightforward, it even has a Freetype engine extension that lets you render the fonts on the fly using a texture atlas. To generate the bitmap font you just do:

FreeTypeFontGenerator ftfg = new FreeTypeFontGenerator(fileHandle);

And to render text use a SpriteBatch to render text like this:

font.draw(sbatch, text, X, Y);


The transitions are fairly straightforward. There are the automatic transitions (like scrolling leftward from the game start) or pushing a button when touching a transition body (like pressing the down button whe you're touching the pipe in the dungeon).

Get the Android build on my Google Drive.

No hay comentarios:

Publicar un comentario