# LibGDX

libGDX is a free and open-source game-development application framework written in the Java programming language with some C and C++ components for performance dependent code. It allows for the development of desktop and mobile games by using the same code base. It is cross-platform, supporting Windows, Linux, macOS, Android, iOS, BlackBerry and web browsers with WebGL support.

## History

In the middle of 2009 Mario Zechner, the creator of libGDX, wanted to write Android games and started developing a framework called AFX (Android Effects) for this. When he found that deploying the changes from Desktop to Android device was cumbersome, he modified AFX to work on the Desktop as well, making it easier to test programs. This was the first step toward the game framework later known as libGDX.
In March 2010 Zechner decided to open-source AFX, hosting it on Google Code under the GNU Lesser General Public License (LGPL). However, at the time he stated that "It's not the intention of the framework to be used for creating desktop games anyway", intending the framework to primarily target Android. In April, it got its first contributor. In October, Nathan Sweet joined and eventually became a top contributor, sharing the copyright.
When Zechner created a Box2D JNI wrapper, this attracted more users and contributors because physics games were popular at the time. Many of the issues with Android were resolved because of this.
Because many users suggested switching to a different license due to LGPL not being suitable for Android, libGDX changed its license to the Apache License 2.0 in July 2010, making it possible to use the framework in closed-source commercial games. The same month its phpBB forum was launched.
Due to issues with Java Sound the audio desktop implementation switched to OpenAL in January 2011. Development of a small image manipulation library called Gdx2D was finished as well, which depends on the open source STB library.
The rest of 2011 was spent adding a UI library and working on the basics of a 3D API.
At the start of 2012 Zechner created a small helper library called gdx-jnigen for easing the development of JNI bindings. This made it possible for the gdx-audio and gdx-freetype extensions to be developed over the following months.
Inspired by Google's PlayN cross-platform game development framework that used Google Web Toolkit (GWT) to compile Java to JavaScript code, Zechner wrote an HTML/JavaScript backend over the course of several weeks, which allowed libGDX applications to be run in any browser with WebGL support. After Google abandoned PlayN, it was maintained by Michael Bayne, who added iOS support to it. libGDX used parts of this work for its own MonoTouch-based backend.
In August 2012 the project switched its version control system from Subversion to Git, moving from Google Code to GitHub. However, the issue tracker and wiki remained on Google Code for another year. The main build system was also changed to Maven, making it easier for developers with different IDEs to work together.
Because of issues with the MonoTouch iOS backend Niklas Thernig wrote a RoboVM backend for libGDX in March 2013, which was integrated into the project in September. From March to May 2013 a new 3D API was developed as well and integrated into the library.
In June 2013 the project's website was redone, now featuring a gallery where users can submit their games created with libGDX. As of January 2016 more than 3000 games have been submitted.
After the source code migration to GitHub the year before, in September 2013 the issue tracker and wiki were also moved there from Google Code. The same month the build and dependency management system was switched from Maven to Gradle.
After a cleanup phase in the first months of 2014 libGDX version 1.0 was released on 20 April, more than four years after the start of the project.
In 2014 libGDX was one of the annual Duke's Choice Award winners, being chosen for its focus on platform-independence.
   From a diverse team of open source enthusiasts comes libGDX, a cross-platform game development framework that allows programmers to write, test, and debug Java games on a desktop PC running Windows, Linux, or Mac OS X and deploy that same code to Android, iOS and WebGL-enabled browsers—something not widely available right now. The goal of libGDX, says creator Mario Zechner, "is to fulfill the 'write once, run anywhere' promise of the Java platform specifically for game development."
In April 2016 it was announced that libGDX would switch to Intel's Multi-OS Engine on the iOS backend after the discontinuation of RoboVM. With the release of libGDX 1.9.3 on 16 May 2016 Multi-OS is provided as an alternative, while by default the library uses its own fork of the open source version of RoboVM.

### libGDX Jam

From 18 December 2015 to 18 January 2016 a libGDX game jam was organized together with RoboVM, itch.io and Robotality. From initially 180 theme suggestions "Life in space" was chosen as the jam's main theme, and 83 games were created over the course of the competition.

### Release versions

| Version | Release date |
| class="templateVersion co swatch-unsupported" style="color: var(--color-base, #202122); " title="Old version, not maintained" data-sort-value="1.0" | Old version, not maintained: 1.0 | 20 April 2014 |
| class="templateVersion co swatch-unsupported" style="color: var(--color-base, #202122); " title="Old version, not maintained" data-sort-value="1.1" | Old version, not maintained: 1.1 | 23 May 2014 |
| class="templateVersion co swatch-unsupported" style="color: var(--color-base, #202122); " title="Old version, not maintained" data-sort-value="1.2" | Old version, not maintained: 1.2 | 22 June 2014 |
| class="templateVersion co swatch-unsupported" style="color: var(--color-base, #202122); " title="Old version, not maintained" data-sort-value="1.3" | Old version, not maintained: 1.3 | 9 August 2014 |
| class="templateVersion co swatch-unsupported" style="color: var(--color-base, #202122); " title="Old version, not maintained" data-sort-value="1.4" | Old version, not maintained: 1.4 | 10 October 2014 |
| class="templateVersion co swatch-unsupported" style="color: var(--color-base, #202122); " title="Old version, not maintained" data-sort-value="1.5" | Old version, not maintained: 1.5 | 8 December 2014 |
| class="templateVersion co swatch-unsupported" style="color: var(--color-base, #202122); " title="Old version, not maintained" data-sort-value="1.6" | Old version, not maintained: 1.6 | 6 May 2015 |
| class="templateVersion co swatch-unsupported" style="color: var(--color-base, #202122); " title="Old version, not maintained" data-sort-value="1.7" | Old version, not maintained: 1.7 | 21 September 2015 |
| class="templateVersion co swatch-unsupported" style="color: var(--color-base, #202122); " title="Old version, not maintained" data-sort-value="1.8" | Old version, not maintained: 1.8 | 5 January 2016 |
| class="templateVersion co swatch-unsupported" style="color: var(--color-base, #202122); " title="Old version, not maintained" data-sort-value="1.9" | Old version, not maintained: 1.9 | 24 January 2016 |
| class="templateVersion co swatch-unsupported" style="color: var(--color-base, #202122); " title="Old version, not maintained" data-sort-value="1.10" | Old version, not maintained: 1.10 | 18 April 2021 |
| class="templateVersion co swatch-unsupported" style="color: var(--color-base, #202122); " title="Old version, not maintained" data-sort-value="1.11" | Old version, not maintained: 1.11 | 11 May 2022 |
| class="templateVersion co swatch-unsupported" style="color: var(--color-base, #202122); " title="Old version, not maintained" data-sort-value="1.12" | Old version, not maintained: 1.12 | 2 July 2023 |
| class="templateVersion c swatch-latest" style="color: var(--color-base, #202122); " title="Latest version" data-sort-value="1.13" | Latest version: 1.13 | 17 October 2024 |

## Architecture

libGDX allows the developer to write, test, and debug their application on their own desktop PC and use the same code on Android. It abstracts away the differences between a common Windows/Linux application and an Android application. The usual development cycle consists of staying on the desktop PC as much as possible while periodically verifying that the project still works on Android. Its main goal is to provide total compatibility between desktop and mobile devices, the main difference being speed and processing power.

### Backends

The library transparently uses platform-specific code through various backends to access the capabilities of the host platform. Most of the time the developer does not have to write platform-specific code, except for starter classes (also called launchers) that require different setup depending on the backend.
* On the desktop the Lightweight Java Game Library (LWJGL) is used. There is also an experimental JGLFW backend that is not being continued anymore. In Version 1.8 a new LWJGL 3 backend was introduced, intended to replace the older LWJGL 2 backend.
* The HTML5 backend uses the Google Web Toolkit (GWT) for compiling the Java to JavaScript code, which is then run in a normal browser environment. libGDX provides several implementations of standard APIs that are not directly supported there, most notably reflection.
* The Android backend runs Java code compiled for Android with the Android SDK.
* For iOS a custom fork of RoboVM is used to compile Java to native iOS instructions. Intel's Multi-OS Engine has been provided as an alternative since the discontinuation of RoboVM.

### Other JVM languages

While libGDX is written primarily in Java, the compiled bytecode is language-independent, allowing many other JVM languages to directly use the library. The documentation specifically states the interoperability with Ceylon, Clojure, Kotlin, Jython, JRuby and Scala.

## Extensions

Several official and third-party extensions exist that add additional functionality to the library.

### gdxAI

An artificial intelligence (AI) framework that was split from the main library with version 1.4.1 in October 2014 and moved into its own repository. While it was initially made for libGDX, it can be used with other frameworks as well. The project focuses on AI useful for games, among them pathfinding, decision making and movement.

### gdx freetype

Can be used to render FreeType fonts at run time instead of using static bitmap images, which do not scale as well.

### Box2D

A wrapper for the Box2D physics library was introduced in 2010 and moved to an extension with the 1.0 release.

### packr

A helper tool that bundles a custom JRE with the application so end users do not have to have their own one installed.

## Notable games and apps

* Ingress (before it was relaunched as Ingress Prime)
* Slay the Spire
* Delver
* Mindustry
* Shattered Pixel Dungeon
* Wildermyth
* Spine (software)