Monday, July 20, 2015

LibGDX: Howto create your first project

LibGDX (http://libgdx.badlogicgames.com/) is a framework based on Java to create game for different platforms: PC, web and mobile phone, both Android and iPhone.

I am learning it and I want to share here my test :)

The aim of this first post is the setup of the environment and the creation of an empty project.


How to start...

First, you have to download the Gradle based application from libGDX download page














And select "Download Setup App". You will download the file gdx-setup.jar. Then, from the directory where you have just saved this file you have to execute:

java -jar gdx-setup.jar

Now you can configure your first project



Now you can configure your fist application in this way:
  • Name: logging
  • Package: com.blogspot.mytechpg.libgdx.test1
  • Game class: Logging
Then, you have to select Advanced and click on Eclipse

And then "Generate".

Import in eclipse

Here you can find the howto to install gradle in eclipse:
https://github.com/spring-projects/eclipse-integration-gradle/

Now you can open eclipse and import the new project:

You have to select "Gradle project":


In the next panel you can select the just generated project and then click on "Build model"


Now you can select the projects you want to import and then click on "Finish"


Then to execute the Desktop version you select "Logging-desktop" with a right click and then "Run as a java application". In the popup window you have to select "DesktopLauncher"

You can find source code here:  https://github.com/mytechpg/libgdx-samples/tree/dev/logging.

You download the tag release for this tutorial with these commands:

To download the source code repo:
27224b84e463d5ed9099bc085113ef5d8a1ddb43
git clone -b dev https://github.com/mytechpg/libgdx-samples.git

To select the correct release:
git checkout 27224b84e463d5ed9099bc085113ef5d8a1ddb43