LibKTX: Kotlin extensions for LibGDX games and applications
Clone or download
Latest commit 76ae5c4 Sep 20, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Updated contributors. #14 Aug 24, 2018
actors Removed old migration guides. #136 Apr 29, 2018
app Improved ktx-graphics module. #138 Apr 29, 2018
ashley Meaningful exceptions for missing no-arg constructor. #157 Sep 20, 2018
assets FreeType font loading method now returns Asset wrapper. #113 Dec 3, 2017
async Updated to Kotlin Coroutines 0.26.1. #156 Sep 20, 2018
box2d Init block in World.body extension method is now optional. #132 Mar 7, 2018
collections Refactored sets test in collections module. #109 Jul 27, 2018
freetype-async KtxAsync.asynchronous method is now inlined. #142 Jul 27, 2018
freetype Added font generation DSL. #113 Jan 27, 2018
gradle/wrapper Updated to Gradle 4.10.2. #156 Sep 20, 2018
graphics Improved ktx-graphics module. #138 Apr 29, 2018
i18n Removed author comments. #43 May 22, 2017
inject Binding methods now consume KClasses instead of Java Classes. #124 Jan 26, 2018
log Code and Gradle scripts reformatting. #87 Jun 15, 2017
math Update Mar 9, 2018
scene2d Removed old migration guides. #136 Apr 29, 2018
style Removed old migration guides. #136 Apr 29, 2018
vis-style VisUI actors style definitions now use default inlined parameters. #94 Dec 17, 2017
vis Removed old migration guides. #136 Apr 29, 2018
.gitattributes Updated to Gradle 4.0. #86 Jun 15, 2017
.gitignore Project creation. Jul 1, 2016
.travis.yml Updated to Gradle 4.0. #86 Jun 15, 2017 Added Gradle update to changelog. #156 Sep 20, 2018
LICENSE.txt Changed license to CC0. #50 Apr 17, 2017 Updated to Kotlin 1.2.70. #156 Sep 20, 2018
build.gradle Updated to Kotlin 1.2.0. #114 Nov 28, 2017 Updated to Kotlin Coroutines 0.26.1. #156 Sep 20, 2018
gradlew Updated to Gradle 4.0. #86 Jun 15, 2017
gradlew.bat Included Gradle wrapper. #68 May 16, 2017
intellij-formatter.xml Updated IntelliJ code formatter. #87 Jun 15, 2017
settings.gradle Add ShapeRenderer utilities method Mar 27, 2018
version.txt Changed library version to 1.9.8-b5. #159 Sep 20, 2018

Travis CI Maven Central Kotlin LibGDX


Kotlin utilities for LibGDX applications.

About the project

KTX aims to make LibGDX as Kotlin-friendly as possible without turning the API upside down. It provides modular utilities for certain parts of LibGDX with poor Kotlin support. This is not a new framework by any means - but Kotlin certainly makes LibGDX feel like one.

Do not confuse KTX with android-ktx: an official Google project with Android utilities. "KTX" name was chosen long before the Android project was announced.


KTX was designed to be modular from day one: in fact, some of these libraries are just a single Kotlin file. After all, you might not want or need all modules in your application. When possible, the extensions do not depend on the standard Kotlin library - and even if they do, it is marked as a provided dependency. You can choose the Kotlin version that suits you best and it will not be overridden by your build system.

Current KTX modules:

  • actors: general Scene2D utilities for stages, actors, actions and event listeners.
  • app: ApplicationListener abstract implementations and other general LibGDX application utilities.
  • ashley: Ashley entity-component-system utilities.
  • assets: resources management utilities.
  • async: coroutines context based on LibGDX threading model.
  • box2d: Box2D physics engine utilities.
  • collections: extensions for LibGDX custom collections. Based on Kotlin standard library utilities.
  • freetype: FreeType font loading utilities.
  • freetype-async: FreeType font loading utilities for the async module.
  • graphics: utilities related to rendering tools and graphics.
  • i18n: some simple extensions that make LibGDX internationalization API less verbose, safer and easier to use.
  • inject: unsettlingly simple dependency injection with nearly zero runtime overhead and no reflection trickery.
  • log: minimal runtime overhead cross-platform logging using inlined blocks.
  • math: operator overloads for LibGDX math API and general math utilities.
  • scene2d: type-safe Kotlin builders for Scene2D GUI.
  • style: enhances Skin API with type-safe builders of official Scene2D widget styles. Replace your JSON skin file with type-safe DSL.
  • vis: type-safe Kotlin builders for VisUI. An alternative to the scene2d module.
  • vis-style: enhances Skin API with type-safe builders of VisUI widget styles. An extension of style module.

Note that most guides and examples assume that the reader is at least a bit familiar with the LibGDX API.

Afraid to use some third-party code? Browse through the sources, run the test suites. While certainly not perfect, we try to keep to keep the public API clean and every feature fully unit tested. Note: coverage tools still have problems with Kotlin inlined methods, so the reported code coverage might be much lower than the actual.


KTX libraries are currently in late beta. While tested and stable enough, we want to give them a little bit more time and get some user feedback before a stable release. All versions are available through Maven Central and here. You can also use the preview snapshot releases from repository.

All libraries follow the same naming schema - this is an example Gradle dependency:

compile "io.github.libktx:ktx-$module:$ktxVersion"

Replace $module with the name of required KTX library. $ktxVersion usually matches LibGDX version it was compiled against - although it might end with -b1 (if it is a beta release) or -SNAPSHOT (if you are using the snapshots). For example, the first official beta release with the current group ID was compiled against LibGDX 1.9.6 and its version was 1.9.6-b2. You can browse through our releases here.

Note that even snapshots should be more or less stable, as libraries are not pushed to Maven Central unless they pass the extensive tests.


Each module contains a file with a list of all features or a guide with a few code snippets. Browse through the directories in root folder to find out more about each library. GitHub releases also contain archives with generated Dokka documentation for each module.

Contribution and working from sources

If you want to help, read the contribution guideline and browse through the issues to see what's currently to do. Don't be afraid to create issues just to ask a question or make a request for any kind of improvements. Before creating any pull requests, be aware that the code is dedicated to public domain.