Getting Started with libGDX, a Cross-platform Game Development Framework

Published: 06/03/2014, Last Updated: 06/03/2014

Developers who want to develop and debug code on the desktop, natively yet be able to run it on multiple OSs without modification will want to know about libGDX. LibGDX is a Java* game development framework composed of a unified API that works across several platforms. It currently supports Linux*, Windows*, Android*, iOS*, Mac OS X*, and HTML5.

You can find the official documentation here.

To use libGDX, applications must be written in Java. If you have questions about using libGDX, a handy forum is available.

The first step is to set up your development environment. You can read about it here.

In addition to installing Eclipse*, Android SDK, JDK, and ADT plugin, you need the Gradle tooling for Eclipse (see Eclipse-Integration-Gradle project). 

In Eclipse, go to Help > Install New Software:

libgdx fig 01

Install all applications:

libgdx fig 02

Next, create a libgdx project:

To install libGDX, download the gdx-setup.jar here.

After downloading and installing libGDX, you will see this window, allowing you to configure your project.

libgdx fig 03

Fill out the form and click the “Generate” button. You are ready to import a project into your IDE.

In Eclipse you can import your project with the series of commands Import > Gradle > Gradle Project:

libgdx fig 04

On the next dialog, click the Browse button and find the root of your project. Then click Build Model:

libgdx fig 05

Eclipse will download different packages that are needed and build the project. If no errors occur, you will see:

libgdx fig 06

Your project is ready for you to work on.

Since I only chose one OS in the project setup, my project contains only two packages: the FirstLibGDX-core package is for the logic of your game. And the FirstLibGDX-android package contains the code for Android activities.

Product and Performance Information

1

Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.

Notice revision #20110804