Hi !
Featured games (84)
games approved by the League of Dukes
Games in Showcase (604)
Games in Android Showcase (171)
games submitted by our members
Games in WIP (654)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  libGdx, Pixmaps, and BitmapFonts  (Read 5065 times)
0 Members and 1 Guest are viewing this topic.
Offline Geemili

Senior Devvie

Medals: 9
Projects: 1
Exp: 2 years

No Games Finished

« Posted 2012-04-10 19:59:48 »

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?
Offline pitbuller
« Reply #1 - Posted 2012-04-10 20:09:19 »

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.
Offline Geemili

Senior Devvie

Medals: 9
Projects: 1
Exp: 2 years

No Games Finished

« Reply #2 - Posted 2012-04-10 20:19:54 »

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.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline davedes
« Reply #3 - Posted 2012-04-10 21:19:36 »

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. Tongue (speaking from experience)

Offline Geemili

Senior Devvie

Medals: 9
Projects: 1
Exp: 2 years

No Games Finished

« Reply #4 - Posted 2012-04-10 22:35:42 »

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

*Goes to google*
Offline Geemili

Senior Devvie

Medals: 9
Projects: 1
Exp: 2 years

No Games Finished

« Reply #5 - Posted 2012-04-11 03:52:22 »

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.
Offline davedes
« Reply #6 - Posted 2012-04-11 05:30:55 »

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 -
wiki -
LibGDX + TWL -
forum -

More LibGDX UI info:

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.

Offline UprightPath
« Reply #7 - Posted 2012-04-11 06:22:00 »

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.

Offline ReBirth
« Reply #8 - Posted 2012-04-11 06:33:34 »

No, but he said this on new update

"Fixes and additions to the UI framework".

Offline badlogicgames

« JGO Bitwise Duke »

Medals: 75
Projects: 2

« Reply #9 - Posted 2012-04-11 08:47:30 »

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 - musings on Android and Java game development
Pages: [1]
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.

bilznatch (27 views)
2015-08-04 11:03:17

SHC (44 views)
2015-08-01 03:58:20

Jesse (25 views)
2015-07-29 04:35:27

Riven (48 views)
2015-07-27 16:38:00

Riven (26 views)
2015-07-27 15:35:20

Riven (28 views)
2015-07-27 12:26:13

Riven (19 views)
2015-07-27 12:23:39

BurntPizza (42 views)
2015-07-25 00:14:37

BurntPizza (56 views)
2015-07-24 22:06:39

BurntPizza (35 views)
2015-07-24 06:06:53
List of Learning Resources
by gouessej
2015-07-09 11:29:36

How Do I Expand My Game?
by bashfrog
2015-06-14 11:34:43

List of Learning Resources
by PocketCrafter7
2015-05-31 05:37:30

Intersection Methods
by Roquen
2015-05-29 08:19:33

List of Learning Resources
by SilverTiger
2015-05-05 10:20:32

How to: JGO Wiki
by Mac70
2015-02-17 20:56:16

2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!