Getting a bit cozy are you, what with your scene2d application compiling smugly? Say no more, I have a treat for you!
As you know, TableLayout is one of my (Nate’s) OSS projects. The core performs UI toolkit agnostic layout and only a small bridge needs to be written to layout for the toolkit of your choice. The UI toolkits it supports are Swing, Android, TWL and of course libgdx’s scene2d.ui. Sadly, few outside of libgdx have seen the blessed layouting light and continue to plod along with suboptimal tools. Anyway, the bridge makes for some slight API awkwardness and extra indirection under the covers. Since TableLayout is mostly used for scene2d and given that I certainly don’t want to (or plan to) subject myself to the pain of using other UI toolkits, I figured we might as well fork TableLayout and integrate it properly into libgdx.
Rest assured, everything is now completely forked. What is left are two classes: Table and Cell. They work mostly as they did before, but you’ll need to organize your imports since they are now in the scene2d.ui package. The API has changed slightly:
- Cell#getWidget -> Cell#getActor
- Cell#setWidget -> Cell#setActor
- Other methods with “widget” in name -> “actor”, since they take Actor, not Widget.
- cell.getLayout().getTable() -> cell.getTable()
- Cell#ignore is gone. This was never used AFAIK mostly on account of not being very useful.
- TableLayout and Toolkit are gone. Table does it all.
In addition, Value has changed a bit. It is simpler and no longer specific to Table. I plan to use it elsewhere soon, eg in Container.
So there you have it. API breakage should be easy to fix and the new Table works as it did before.