Hurray, libgdx 0.7 is here. Lots of things have changed. Nahhh just kidding :p It’s just a couple of small changes which should make working with libgdx easier. Here we go:
- Multitouch support, see this test for an example of how to use it.
- Support for interleaving packed 32-bit colors in Meshes. Instead of using 4-floats per vertex you can now use a 32-bit argb encoded int, 8-bit for each channel. By this i was able to reduce memory consumption and transfer of SpriteBatch by nearly 50% which gave it a nice boost :). Check out the MeshTest for an example.
- Methods creating new resources such as Textures, Pixmaps, Sounds or Music will no longer return null to indicate an error. I fought lazy me and added GdxRuntimeException throwing with nice error messages so you immediatly know that you couldn’t load a specific resource or read/write a file.
- Removed some stuff of the math.collision package. It was experimental and people started using it. Now you can’t anymore :p. It didn’t work properly anyways. It will return eventually. In the meantime use com.badlogic.gdx.math.Intersector instead
- Intersector also got a bit of a face lift and does not instantiate temporary objects anymore. Yes, sometimes i’m stupid…
- Fixed a memory leak in JointType.getType() which would create temporary objects all the time. See above…
- Fixed a few other minor bugs, mainly in the tests
- New, pay Attention! RenderListener and ApplicationListener do not get Application instances handed to them anymore! The same is true for all other classes like Mesh, SpriteBatch, OrthographicCamera and so on that wanted you to provide them with all sorts of silly instances. This got fixed. All modules of libgdx (Application, Graphics, Input, Audio, Files) can now be accessed via the new Gdx class which hold public static members with references to those sub systems. They are currently not final so you could potentially overwrite them. I know this is a major shortcoming but it eases other pains a lot. Don’t mess with the references! In future versions i’ll probably make them final and do some reflection magic (if that works with final fields, reflection seems to be messy with those…). Note that access is of course not thread safe (it wasn’t before either…)
- New, pay Attention! All graphical resources are now managed by default. This includes Mesh, Texture, ShaderProgram, FrameBuffer, SpriteBatch, ImmediateRenderer, Font and so on. The only resource that you can have in an unmanaged way are Textures. The Graphics interface changed slightly and has new methods called Graphics.newUnmanagedTexture() and Graphics.newTexture(). The former will create an unmanaged texture either from a Pixmap or from given dimensions. If the application pauses you are yourself responsible to restore the Texture! If you use Graphics.newTexture() the returned Texture will be managed. The method only works with FileHandles as sources. Managed textures can not be manipulated, e.g. you can’t draw a Pixmap onto them. Yes, i know this is a loss of functionality, but trust me, the old version was worse. It used up 2x the memory for each managed resource. As it is now there’s no overhead involved with managed resources.
- Speed improvements everywhere
- Reworked all the examples and demo projects. That took me like 5 hours. I’ll never change the API again. Ever
- Added a build script to the source tree, see trunk/gdx/build.xml. You’ll need the latest ant. You’ll also need to set the environment variable NDK_HOME to the path where ndk-build is located. The script will construct the full distribution of libgdx and will update the jar dependencies of the demo projects in the trunk. The only thing that’s not automated with the build script is the compilation of the native libraries for the desktop. I’ll eventually get to that but ant gets in my way…
- Updated the README
- Probably a few more goodies i simply forgot about
Apart from all the above i started to write an in-depth libgdx tutorial wiki page over at http://code.google.com/p/libgdx/wiki/TheTutorial. Give me some time, i’ll eventually touch every aspect of libgdx. It’s more like a developer’s guide really.
Me sleep, Me hungry, Me out…