libGdx, Pixmaps, and BitmapFonts

I am having a dilemma right now. I am making a GUI system for my game, and all GUI need some kind of text. Some things might be able to have a static text, but others need dynamic text. So, I just use libGdx’s built-in BitmapFont. My problem now is that I want to use only one Pixmap for all of my GUI components/widgets. So I got rid of my widgets draw function, because they don’t need to update every second. But now the BitmapFont won’t work, because I don’t know how to draw text to them. I see two options right now:

  1. Bring back the draw function.
  2. Make my own texture holding the alphabet and make my own renderer.

I’m leaning toward option 2, but if there is a better way, I would rather not draw 26 characters (All caps). What do you suggest I do?

Are you drawing pixmaps to screen? why? I bet you have understand something horrible wrong. Pixmaps are used to provide data for textures, they are horrible slow for rendering stuff to screen per frame basis.

Just draw textureRegions/textures and top of that draw bitmap font. Simple and effective.

You can’t actually draw them directly to the screen, you have to make it into a texture first. I just make the Pixmap into a texture whenever I need to update the GUI. After editing the Pixmap first.

…But I guess you’re right. That means I have to make graphics for all the widget that need it… Which wouldn’t be that difficult. Now that I think of it, why dif I even use Pixmaps in the first place? Ah well. To work.

What’s wrong with the built-in LibGDX ui? Or TWL if you need more complex widgets?

A lot of the time people reinvent the wheel only to make it worse. :stuck_out_tongue: (speaking from experience)

Wait, libGdx has a built in GUI? I never knew that.

Goes to google

After a long time of searching, I found two things. I found that libGdx does indeed have a GUI built-in and also has a TWL extension. It may be because I am tired, but I am having trouble understanding how to use them. I looked for tutorials of either one, but there isn’t any. If I can’t find a tutorial, I will just continue with making my own GUI system. And, it might not be that bad.

There isn’t much documentation on LibGDX’s UI, it seems. Most people learn by looking at JavaDocs or looking through tests and source code.

TWL includes a Wiki as well as lots of code tutorials, and even has a forum where you can post troubles:
demos - http://twl.l33tlabs.org/#demo
wiki - http://wiki.l33tlabs.org/bin/view/TWL/
LibGDX + TWL - http://dpk.net/2011/03/10/libgdx-and-twl/
forum - http://slick.javaunlimited.net/viewforum.php?f=18

More LibGDX UI info:
http://code.google.com/p/libgdx-users/wiki/mixedUI

LibGDX’s UI classes are pretty compact – you should be able to skim them easily to get an idea of how they work. Learning to use these libraries would probably be wiser than trying to recreate their functionality from scratch, which becomes a lot of work when you consider clipping, input, complex widgets, etc.

From what I understand, in the latest version of libGDX the TWL style interface is no longer being supported. Unless I’m completely wrong, and just failed in using it when I was messing around with it.

No, but he said this on new update

“Fixes and additions to the UI framework”.

TWL is still working, but we lack a person maintaining the bindings. You can also look at this series of tutorials which introduces the UI http://steigert.blogspot.com/