Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / STL

How to Run Your Libgdx Game on Your Desktop

5.00/5 (2 votes)
25 Sep 2017CPOL1 min read 7.8K  
How to run your Libgdx game on your desktop

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.

Image 1

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

Image 2

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:

Image 3

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!

Image 4

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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)