Repository navigation
Setting up your project
Before you can begin coding, you'll need to set up your development environment. In the guide we'll install Java, an integrated development environment (IDE), LibGDX and mini2Dx.
Windows
You can download the latest version of the JDK from oracle.com. Once downloaded run the installer.
Mac OS X
You can download the latest version of the JDK from oracle.com. Once downloaded run the installer.
Ubuntu 12.04 LTS
You can install the JDK by running the following commands in a terminal:
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
Download LibGDX version 0.9.8 and extract it on your machine.
Download mini2Dx version 0.9 and extract it on your machine.
- Download and install the Eclipse IDE.
- Create a new Java project in Eclipse: File -> New -> Project -> Java Project. Give it a name and click Finish.
- Go to the project folder on the file system and create a sub-folder named libs.
- Place gdx.jar and gdx-sources.jar from your LibGDX folder into the libs folder.
- Place gdx-freetype.jar from the extensions -> gdx-freetype folder in your LibGDX folder into the libs folder.
- Place mini2Dx-core.jar, mini2Dx-dependency-injection.jar, mini2Dx-ecs.jar and mini2Dx-tiled.jar from the mini2Dx folder into the libs folder.
- In Eclipse, right click the project -> Refresh.
- Right click again -> Properties -> Java Build Path -> Libraries -> Add JARs, select gdx.jar and gdx-freetype.jar then click OK.
- Under the gdx.jar file, double click "Source attachment", click Workspace, select the gdx-sources.jar and click OK.
- Click the Order and Export tab, check the gdx.jar, gdx-freetype.jar, mini2Dx-core.jar, mini2Dx-dependency-injection.jar, mini2Dx-ecs.jar and mini2Dx-tiled.jar then click OK.
- Create a new Java project in Eclipse: File -> New -> Project -> Java Project. Name it appropriately (e.g. "game-name-desktop") and click Finish.
- Go to the project folder on the file system and create a sub-folder named libs.
- Place gdx-natives.jar, gdx-backend-lwjgl.jar and gdx-backend-lwjgl-natives.jar in the libs folder.
- Place gdx-freetype-natives.jar form the extensions -> gdx-freetype folder in your LibGDX folder into the libs folder.
- Place the mini2Dx-dependency-injection-desktop.jar from the mini2Dx folder into the libs folder.
- In Eclipse, right click the project -> Refresh. Right click again -> Properties -> Java Build Path -> Libraries -> Add JARs, select the five JARs and click OK.
- Click the Projects tab, click Add, check the main project and click OK.
- Create a new Android project in Eclipse: File -> New -> Project -> Android Project. Name it appropriately (e.g. "game-name-android").
- For build target, check "Android 1.5". Specify a package name (eg, "com.gamename"). Next to "Create Activity" enter "AndroidGame". Click Finish.
- Go to the project folder on the file system and create a subfolder named libs.
- Place mini2Dx-dependency-injection-android.jar form the mini2Dx folder into the libs folder.
- Place gdx-backend-android.jar and the armeabi and armeabi-v7a folders from the LibGDX folder into the libs folder.
- Copy all files from the armeabi and armeabi-v7a folders under extensions -> gdx-freetype in your LibGDX folder into the armeabi and armeabi-v7a folders you created in the libs folder.
- In Eclipse, right click the project -> Refresh. Right click again -> Properties -> Java Build Path -> Libraries -> Add JARs, select gdx-backend-android.jar and mini2Dx-dependency-injection-android.jar then click OK.
- Click Add JARs again, select gdx.jar under the main project and click OK.
- Click the Projects tab, click Add, check the main project and click OK twice.
- Click the Order and Export tab, check the main project.
You're all ready to start making games. Make sure to read the Basic Concepts tutorial first. Then check out our Tutorials Section for more tutorials.