When just starting out in Libgdx to develop a mobile game, I came into a fast realization. It’s a big pain to constantly test my changes from the game to my phone.
Luckily, I quickly realized that you can run your game on your desktop instead of Android. Hurray for cross-platform!
Here’s a brief guide on how you would go about running your game on your desktop (I’ll be working under the assumption that you’ll be working with this in Android Studio.
The first thing we’ll need to do is to go to Edit Configuration.

In the new dialog, click on the green plus button and select the option to create a new Application.

Now select the unnamed configuration under Application that just showed up. Here are the settings I’d change:
- Name: Desktop
- Main Class: Select the Desktop Launcher
- Working Directory: Select the asset folder located in your Android folder
- User classpath of module: Select desktop
You should have something like this:

Once you’re happy with your changes, click OK.
To run your new desktop application, select Desktop under the pull down next to your green run button where you clicked Edit Configuration and there you go, you have your game running on the desktop!

Hopefully, this has been helpful to making you speed up your development especially if you don’t want to always test on your Android device first!
Good luck and happy developing!
The post How to run your Libgdx game your desktop appeared first on Coding Chronicles.
CodeProject