Coming straight from creating your very first libGDX project, your main class and project folder should look like the following:
Now we are going to enable the feature that I believe is one of the best reasons for using libGDX, that is testing the game in the desktop mode. To do that, we need to open “Run/Debug Configurations” window -> click the green arrow on the top left and select “application” and edit it as follows:
Click “ok” and continue. Now the desktop launcher should be the default debugging launcher and when you “run” or “shift+f10”, the following should happen:
Note: The most common error is the resource file not found, make sure your working directory in the run configurations is set to the assets folder under android.
A final note is on how to change the screen size of the desktop version. This can be done in the desktop launcher class by adding the commands below:
1 |
public class DesktopLauncher { |
Congratulations, your first game is now a simple picture, but hey, at least something was created, right?
Now its time to actually start making something that moves, or has a time line that we can use to make our game, but before we can begin that, we will start our journey by creating some mental framework for our game to stand upon