Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (491)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (556)
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 4219 times)
0 Members and 1 Guest are viewing this topic.
Offline Geemili

Senior Member


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 Member


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 Member


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 Member


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 - 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 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
« 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 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.

 

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

The first screenshot will be displayed as a thumbnail.

Nickropheliac (15 views)
2014-08-31 22:59:12

TehJavaDev (23 views)
2014-08-28 18:26:30

CopyableCougar4 (29 views)
2014-08-22 19:31:30

atombrot (41 views)
2014-08-19 09:29:53

Tekkerue (38 views)
2014-08-16 06:45:27

Tekkerue (35 views)
2014-08-16 06:22:17

Tekkerue (25 views)
2014-08-16 06:20:21

Tekkerue (34 views)
2014-08-16 06:12:11

Rayexar (72 views)
2014-08-11 02:49:23

BurntPizza (48 views)
2014-08-09 21:09:32
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org 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‑gaming.org
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!