Today i spent my lunch break on trying out IKVM, which is a JVM ontop of .NET and a way to get interoperability between Java Bytecode & the CLI. I was interested in the later as i wanted to try out whether i could use libgdx from C#. Well, that wasn’t all that hard 🙂
Download the latest IKVM binaries, the latest libgdx nightlies and away you go with the following command line:
$IKVM_HOME/bin/: ikvmc -platform:x86 -target:library -out:gdx-cli.dll gdx.jar gdx-natives.jar gdx-backend-lwjgl.jar gdx-backend-lwjgl-natives.jar
You’ll end up with an assembly called gdx-cli.dll. Create a new C# project in Visual Studio, reference the gdx-cli.dll as well as the IKVM and OpenJDK assemblies in the IKVM bin/ folder. Copy the ikvm-native-win32-x86.dll and ikvm-native-win32-x64.dll files to your project and make sure they are copied to the output folder on every build (or when they change). Here’s a screenshot
I only played around with this for 15 minutes, but all the things i tested work. Note that it uses LWJGL as the backend, so you can’t integrate it with a standard Windows Forms/WPF application. On the other hand you can now use libgdx in C# if you want to work with that instead. Compatibility with Android will be lost of course, but you can still stay cross-platform with Mono.
At some point i’ll probably also host .NET nightlies.
hint: if someone gives me a Mac i can try to make this work on IOS 😀