libgdx 0.9.8 released – Hello iOS!

I just released libgdx 0.9.8. Here’s a list of things that were added/changed/fixed:

  • Minor changes to the Livewallpaper API. Note that the LWP support is still a little buggy. It’s a contribution, and while i did quite a bit of clean-up it’s still not entirely where it should be. I’d be super happy if someone took on that backend!
  • If you want to deploy to HTML5 you now need to use GWT 2.5!
  • We have rudimentary Maven support. Thanks a ton to Team Gemserk for libgdx mavenizer and all their help with this!.
  • Android Daydream support, a contribution by talklittle! This one is stable.
  • Gdx controllers extension, for Android/Ouya and desktop. HTML5 could be an option too! Volunteers? (looking at you Nex) Some notes on the current stub backend for HTML5
  • The gdx-net API is now part of core. Fetching things via HTTP should work on all backends. Here’s a little test. Big thanks to Noblemaster and Gemserk who led this effort!
  • Not exactly part of the release, but here’s a quick rundown on how to make your libgdx game work with Ouya!
  • Again, not exactly part of the release, but here’s an awesome guide by Swarm on how to integrate Swarm with your libgdx app! Note that you should probably interface the Swarm API so your desktop project continues to work.
  • First release of the iOS backend, read below 😀

iOS Backend Notes

After many months we finally release the iOS backend to the general public today! I updated all our sites to indicate that we now run on iOS as well (e.g. Project Setup. I recorded a new getting started video that walks you through the setup and how to run/debug your iOS project.

The iOS backend has been made possible through the work of a lot of folks. Michael Bayne of PlayN and Threerings Fame created the IVKM port that let’s you run Java on iOS via MonoTouch. I added JNI support, as we rely on that for various things like box2d. I also created the initial backend code which was then modified and made tons better by Noblemaster Games, Team Gemserk (now part of Ironhide Game Studios) and Gushiku Studios.

All of these folks have released games with libgdx on iOS already (except for Michael which sticks to PlayN). Go check them out and support them!

What you need in addition to your current setup (JDK, Eclipse, Android SDK, GWT):

  • A Mac, sorry, there’s simply no way to deploy to iOS without Mac OS X. I totally don’t know about Hackintosh’, you don’t either, right?
  • Xcode, you can get that from the Mac OS X app store. It’s what’s commonly used to develop iOS apps.
  • A MonoTouch license. You have 3 options:
    • If you just want to test your stuff in the simulator, get the evaluation license. I would strongly suggest getting this and test your app before shelling out money.
    • If you want to deploy to a real device or app store and you are a student, get the student license for 79$
    • If you want to deploy to a real device or app store and you are not a student, get the normal license for 399$
  • Ant. Download and extract the zip to say /Users/you/ant, then create a symlink via ln -s /Users/you/ant/bin/ant /usr/bin/ant
  • Make sure both javac and ant can be executed from the command line!

Once all that is installed, you can use the gdx-setup-ui to create the core, desktop, android, html5 and ios projects. Here’s a video running you through the process, including running and debugging your app on the various platforms (if you want the textual description, read

How it works

Here’s the high-level view on how the iOS backend works for you as an end-user:

  • Your iOS project contains a libs folder. In that folder there are various native libs, dlls and jar files as well as IKVM
  • In the root folder of your iOS project, there’s an ant script called convert.xml and a properties file specifying the parameters for your project
  • When you build your iOS project in MonoTouch, the ant script is invoked as a pre-build step. It will compile the Java files in your core project’s src/ folder, and transpile them to a .Net assembly (.dll file) via IKVM. MonoTouch can then compile the actual MonoTouch project, refercing the core project dll as well as the libgdx dlls among other assemblies.
  • The assets are linked from the Android asset folder, just like it’s the case for the desktop and html5 project

You can run and debug your iOS project like any other MonoTouch application. You can even debug the Java source directly. Just open up any Java file from your core project in MonoTouch and set a breakpoint!

There are a few caveats:

  • Classpath resources can not be loaded on iOS. This means the default BitmapFont constructor without arguments will not work!
  • Some Java runtime classes are not available, this mostly concerns the java.net and crypto packages. We have a replacement for most of java.net’s functionality in the new gdx-net API which is part of core
  • You need to link any new asset files you add to the Android project’s asset folder manually in MonoTouch. Right click in the project view, then select Add Files or something similar and link your new assets. After this is done, you have to right click your linked assets again and set their Build Action to “Content”. If you don’t do that, your app will crash as the assets won’t be included in the final build output.
  • You must clean and rebuild your MonoTouch project before you run/debug everytime you modify your Java source code in Eclipse! MonoTouch does not pick up changes to those files and will hence assume the last build is up-to-date.
  • Compile times for the device are rather long. Stay on the simulator most of the time. Note however that some things will only fail on the device.
  • The extensions have not been ported to iOS yet, just a matter of cross compiling the natives
  • OpenGL ES 1.x is not supported. We may add support in the future, but it’s not a priority. GLES 2.0 all the way

There are a few more things to consider. We have a temporary Wiki article that summarizes all our findings so far. We’ll clean that up soon to make the content more accessible.

Thanks again to everyone who’s involved, and have fun with your new shiny toys 🙂

What’s Next

For the 0.9.9 release i’d like to have the following things done and ready for broad testing:

Once those things are done, we’ll release 0.9.9 which should be the last release before the official 1.0 release. Between 0.9.9 and 1.0 we should focus on testing, bug fixing and documentation.

Swarm Connect Libgdx Guide – By Swarm Connect

What is love? Baby don't hurt me

The Swarm team has been in contact with us for quite sometime. Appearently lots of libgdx folks use Swarm, which makes me and Swarm rather happy. After their glorious SDK update earlier this week, they now published a libgdx/Swarm example.

It’s based on our Super Jumper demo game, and shows you how easy it is to get all the great features of Swarm integrated in a libgdx game. Especially with the new Twitter/Facebook/Google+ sign-in, Swarm is a wonderful way to connect your players!

I totally wasn’t paid for this. Really.