Help make libgdx polyglot

I started libgdx as a Java library (with some C/C++ under the hood) Java is the lingua franca to which all other JVM languages can bind, that’s usually not the case the other way around. Making libgdx available to other JVM languages was part of the reason why i tortured myself with the shortcomings of Java.

I want people to realize that you can use a wide range of languages with libgdx, not only on the desktop, but also on Android. I know that some of the hotter JVM languages already work on Android, i think this could be pushed further.

Quite a few people experimented with libgdx and Scala/Clojure/JRuby/Jython. Here’s a short, incomplete, list:

I’ve seen a lot more than those already, but sadly i suck at finding links.

How you can help!

Know Scala/Clojure/JRuby/any other JVM language? Consider helping us out with the following:

  • easy:If you already have some material online, send us a link! No matter what it is
  • medium: For folks knowing your language: write an article on how to use libgdx in your language as idiomatically as possible. Document any issues you came across
  • hard: For folks not knowing your language: write a simple tutorial to get folks up and running with your language of choice and libgdx. Learning a new language through game programming is an excellent oportunity, consider including the following:
    • Setting up the development environment, getting the dependencies to libgdx right
    • Running & Debugging
    • Packaging
    • Deploying to supported platforms, e.g. desktop, Android, maybe even iOS, see below
  • Fatality:Help us provide archetypes, project templates, what have you to make setting up a libgdx project in your language’s environment easier!
  • If possible, let us put all articles on the Wiki, all code on Github or Bitbucket, for greater good!

I would love to help with those things as possible, however, my budget is limited as always. I’d really appreciate if JVM language enthusiasts that are using libgdx could chim in.

Future Possibilities, Caveats

Given these things, i could look into how to make those things work on iOS as well. All these languages compile to Java bytecode, many don’t rely on native code and only a limited subset of the Java Class Library. It might just be possible to get say Scala to run on iOS as well, through the power of IKVM and MonoTouch (or maybe even Avian).

The only caveat: the HTML5/GWT backend does not work through Java bytecode, but Java source code. Not all hope is lost, Kotlin has a Javascript backend that does not seem to rely on GWT. We might just be able to leverage that work to bring more JVM languages to the web, without hideous Java applets.

Gdx controllers update for GWT/HTML5

Nex reported that the GWT/HTML5 version of gdx-invaders doesn’t compile anymore (among other GWT related things). I thus updated the controllers extension to include a stub implementation for the Controllers class. If your project has a desktop, Android and HTML5 version, and if you want to use the controllers extension, do the following:

  • To your core project, add “gdx-controllers.jar”
  • To your desktop project, add “gdx-controllers.jar”, “gdx-controllers-desktop.jar” and “gdx-controllers-desktop-natives.jar”
  • To your Android project, add “gdx-controllers.jar” and “gdx-controllers-android.jar”. Make sure both jars are checked in the Android project’s Order & Export dialog (Properties -> Java Build Path -> Order & Export)
  • To your HTML5 project, add “gdx-controllers.jar”, “gdx-controllers-sources.jar”, “gdx-controllers-gwt.jar” and “gdx-controllers-gwt-sources.jar”

You also need to add the following entry to your gwt.xml file of your HTML5 project: