Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (408)
games submitted by our members
Games in WIP (293)
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 2379 times)
0 Members and 1 Guest are viewing this topic.
Offline Geemili

Junior Member


Projects: 1


No Games Finished


« Posted 2012-04-10 21: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 22: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

Junior Member


Projects: 1


No Games Finished


« Reply #2 - Posted 2012-04-10 22: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!
Play the free demo of Revenge of the Titans!
Offline davedes
« Reply #3 - Posted 2012-04-10 23: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

Junior Member


Projects: 1


No Games Finished


« Reply #4 - Posted 2012-04-11 00:35:42 »

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

*Goes to google*
Offline Geemili

Junior Member


Projects: 1


No Games Finished


« Reply #5 - Posted 2012-04-11 05: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 07: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 - 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.

Offline UprightPath
« Reply #7 - Posted 2012-04-11 08: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 08:33:34 »

No, but he said this on new update

"Fixes and additions to the UI framework".

Offline badlogicgames
« Reply #9 - Posted 2012-04-11 10: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 http://steigert.blogspot.com/

http://www.badlogicgames.com - musings on Android and Java game development
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars and Titan!

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (143 views)
2013-05-17 21:29:12

alaslipknot (151 views)
2013-05-16 21:24:48

gouessej (182 views)
2013-05-16 00:53:38

gouessej (175 views)
2013-05-16 00:17:58

theagentd (186 views)
2013-05-15 15:01:13

theagentd (171 views)
2013-05-15 15:00:54

StreetDoggy (214 views)
2013-05-14 15:56:26

kutucuk (239 views)
2013-05-12 17:10:36

kutucuk (237 views)
2013-05-12 15:36:09

UnluckyDevil (243 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
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!
Page created in 0.078 seconds with 21 queries.