Scene2D, utter tedious

Having worked with some other (some of them “homebrew”) ui libraries I have to say I love scene2d and scene2d.ui. Sometimes the ui creation and handling code can become a bit messy, but you can make your code a lot cleaner by using factories to create the ui elements you are using…

The backbone of my UI’s is the table actor/widget. If you know what the table is capable of and are a bit creative you can achieve pretty much very fast. Also it’s not bad to already have some nice widgets ready… Would not wan’t to implement the scrollpane or textboxes myself :wink:

Check the readme on the github page of the table layout: https://github.com/EsotericSoftware/tablelayout

I dislike the skin system as well.

I’m still trying to figure out how to end up getting fonts to upscale properly (or generate at a proper resolution so that it shows nicely on the screen).

Once you have a skin it is rather easy. It is getting that setup that is hard. Libgdx comes with a default skin you can use.

[quote=“Gibbo3771,post:14,topic:48094”]
Neither of which are present in your code example. I suppose your UI library doesnt magically render itself or create that “list” variable out of thin air?

I felt precisely the same about pretty much any UI library I used and baked my own UI code. But after some time you really need some extra functionality like additional types of widgets, or an easy way to restyle the whole thing. Some time later you end up with an unmanageable inconsistent and buggy mess which eats up half your game development time. Then compare the homebrew solution to something like the Scene2D UI and you get a sensible comparison.

[quote=“Memoryz,post:22,topic:48094”]
Thats an issue with font rendering and has nothing to do with Scene2D. Just generate an upscaled version of your font.

OP, since your problem is “fighting with a whole bunch of exceptions to get Scene2D to agree” I assume you haven’t taken the effort to understand the API. Presenting your opinion so crudely (scene2d is “annoying as shit”) isn’t going to lead to productive discussion. Complain until you are blue in the face, but don’t be surprised that I don’t care about you or your problems. If your goal is solely to complain, remember that scene2d is provided to you at considerable effort for free. If you don’t like it, don’t use it.

StumpyStrust, AFAIK scene2d works correctly. It has been in use in many complex apps for years, so it would quickly become apparent if something didn’t work. A UI library has a number of problems that are difficult to solve in a nice way, such as drawing, responsive layout and event routing. scene2d has a solid approach to these, but it may not be easily apparent why it works the way it does. I’m happy to discuss what you find doesn’t work, but in a different thread.

Sorry I will reword, setting up a skin is annoying, I find it quite over whelming it you want something simple. I have read the documentation, I get it. I can easily setup a basic ui with it.

Just because I find it tedious does not mean I don’t know how to work it.

I never complained about the functionality, nor at any point did I say I never appreciated the free use of the library.

I find your reply pretty aggressive, for no reason at all.

Yeah well in the end, Scene2D is a good library, its used by many to good effect, made by volunteers who know what they are doing. Considering that, its just not so nice to use words like “utter tedious”, “tedious as hell”, “that was horrible”, “god annoying”, “tedious and ugly library”. It would be sad if a post like this would put newbies off using a good library for no good reason.

Fair enough I could have chosen my words better, I would never discourage someone to to use this library!

I never said it was ugly, I said it can make your code look ugly, especially if your just making something simple.

Maybe my post was harsh. I felt your criticism was quite intense with no hint of an attempt at being productive.

Skin does a couple things:

  1. Makes for a centralized place to find resources (colors, fonts, widget styles, etc).
  2. Makes it convenient to convert textures, regions, etc to a drawable, tinted drawable, etc.
  3. Makes it easier to reuse the resources in subsequent apps by specifying the skin as JSON.

If you are making a simple UI and don’t need #3, you probably don’t want to spend the extra effort to describe your skin as JSON.

This class creates a UI with simple code and no Skin JSON:


Most of the code is configuring how the button looks (what texture regions it uses). I don’t see what the big deal is.

Hell I say be happy that you don’t have to use Java’s built in gui…
Have any of you checked out Nifty GUI? It’s used in jMonkeyEngine, but built in LWJGL so any of you that use it (which is many of you) can implement some sort of framework for it into your engine/library/game. It’s pretty neat, it uses XML files for describing the GUI.

You had me at XML.

Scene2DUI is the best, compared to the alternatives. However, yes, its still a little confusing and “verbose” - you need a lot of code.

Create a Pixmap, a skin, a ButtonStyle, apply them all. Its a lot of code.

When what I wanna do is myButton.css(“background-color”, “#000000”); and there you go.

But its not like its a trivial thing to make such a simple library, I made my own UI once and yeah… its quite the work.