libgdx 0.9.6 released

GWT backend should be back to being functional, GwtTestWrapper doesn’t work for whatever fucking reason, demos work though.
GWT backend in nightlies has some issues at the moment, will resolve them once i’m back home…
nightlies are served, trunk compiles again!
itsy tiny update: trunk is broken, have to wait for Nate to wake up

Before Nate merges his scene2d refucktoring, we thought it would be a nice idea to push out one more release. I versioned it as 0.9.6, there aren’t any big additions in there compared to the last release apart from a few bug fixes by arielsan etc. There’s also a tag in SVN if you want to continue working and adding to that release.

Nate will now merge the scene2d-new branch with trunk. There are quite a few changes in there, so make sure you read the following blog posts:

Additionally, Nate added documentation for both scene2d and the ui package contained therein on the wiki.

May the FSM have mercy on us.

PolygonSpriteBatch

Drawing rectangular sprites with a lot of whitespace that get’s cut away through alpha-blending can be a waste for big, static, background elements. PolygonSpriteBatch is here to safe the day. Bach, Shiu and Obli worked on integrating it after a quick design round via Skype/Google Docs. A PolygonSprite is made up of vertices that form a polygon instead of a rectangle. This allows you to more tightly fit the geometry to the relevant portions of the source image. You can find more information at http://www.fainted.dk/?p=142, the new classes are in the latest nightlies.

TexturePacker v2

libgdx has a new texture packer! The old one was slow and the code was absolutely horrible. Here’s a run down of the major differences:

  • The new code is very nice and maintainable. Check it out.
  • Much better packing and much faster. The packing algorithm is the maximal rectangles (MAXRECTS) algorithm by Jukka Jylänki here. He has done some great research! His work was the basis for the new packer, with lots of additions. Packing into a fixed size bin is pretty straightforward, but packing into the smallest size bin possible is quite a pain, especially if you want it to complete in a timely manner. The new libgdx packer uses a brute force binary search and supports packing into multiple bins.
  • All existing settings are supported, except incremental. I may get around to that at some point. Some settings have been renamed for more flexibility, eg padding is now paddingX and paddingY. There is one new setting “fast”, which doesn’t pack quite as well (though it is still very good) but executes very fast. This can be useful when packing at the start of every run of your app.
  • The underscore file name conventions are gone. File names can still have a numeric index, it is simply any numbers at end of the file name, before the file extension. To better control packing in various ways, a “pack.json” file can be placed in each input directory. This contains the JSON for the Settings object. Each directory inherits all settings from the parent directory and any property set here will override those. This also means it is easier to use, as you don’t have to write any Java code. Just wite your “pack.json” files and point the gdx-tools.jar at it. I will write proper documentation for it tomorrow and update this blog post.
  • Files with “.9” before the file extension are considered a ninepatch. The pixels around the edge are read and stripped off before packing the image. The split information is stored in the pack file, enabling TextureAtlas to provide instances of NinePatch. The splits in the TextureAtlas file format are optional, so existing pack files are still compatible.

The new class is called TexturePacker2 and the old TexturePacker class is deprecated. It is committed in the “scene2d-new” branch, which will probably be merged in the next few days. These changes, especially the ninepatch support, will allow for the cleanup of the Skin class. It is currently a weird fork of TextureAtlas, storing both an atlas and styles. Probably it will be refactored to store only styles and TextureAtlas can be used for scene2d.ui.

Edit: The TexturePacker documentation is now up to date.

-Nate