The UI API is now in SVN (and the nightlies). Couple of caveats, warnings, etc.

  • While most of the API is stable, there might be minor changes (or rather additions, hence not API breaking) in the future
  • It’s likely that there are bugs.
  • It of course needs some performance. The UITest below renders at 20fps on the Hero, 26fps on the Samsung Leo (320×240 phone), and 60 on the Nexus One and my HTC Desire, 72fps on the Transformer.
  • I’m in the process of writting the documentation

Considering all this please start experimenting with it. For feature requests please add a message to this issue on the issue tracker. I do not promise to fullfill all requests, but i’ll make sure that we arrive at the largest common denominator.

You can find a basic skin in “test/gdx-tests-android/assets/data/uiskin.xml”. An accompanying test can be found here. Here’s the output of that test.

As i said above, i’m currently writting the documentation for this new API. Please be patient, i do my best to finish it off by Tuesday.

BitmapFont/BitmapFontCache Changes

Attention. Today i fixed this bug. This means that if you use BitmapFont or BitmapFontCache all your text is rendered at integer positions. If you need float positions use the BitmapFont.setUseIntegerPositions() and BitmapFontCache.setUseIntegerPositions() methods to get the old behaviour.

What is the problem? When you render text at non-integer positions, and when your glyphs have very fine grained stems, the texture filters will make your text look crazy bad. It’s most appearant for text that is centered, since you end up with very non-integer positions for each glyph. Here’s an image:

Both texts are rendered at non-integer positions. For the white text the BitmapFont was configured to cast the positions and sizes to int before drawing. The red things you see is the same text, at the same positions without the casting to integer. Fugly eh?

If you didn’t need float positions & sizes so far, nothing has changed for you.

UI Fun on Android with libgdx

Heh, just a quick hack, but i’m pretty happy it works so well!

To be included in trunk, just give me a little more time. Also, it won’t be perfect and will probably contain a few bugs i didn’t catch in its first iteration. Never the less, pretty useful, and with the skinning support it should be easy to create UIs for various densities 🙂

QR Code! This might or might not bomb on your device. It won’t run on phones with Android < 2.0 for various reasons. Though i modified it and it now even works on the Hero (at 4fps :p).