Skip to content

Repository files navigation

gdx-teavm

Build Maven Central Version Snapshot

gdx-teavm is a TeaVM backend set for running libGDX applications outside the JVM. It can generate browser builds with JavaScript or Wasm, native C projects for GLFW, experimental iOS native payloads, and Android native app builds through an Android application module.

The project provides two build styles:

  • Gradle plugin: the recommended workflow for application projects. It applies TeaVM, configures the selected backend, copies assets, prepares generated output, and creates gdx_teavm_* tasks.
  • Manual builder API: a Java launcher API for advanced builds and custom tooling. It directly uses TeaBuilder with WebBackend or TeaGLFWBackend.

Status

gdx-teavm libGDX TeaVM
-SNAPSHOT 1.14.2 0.15.0
1.6.1 1.14.2 0.15.0
1.5.5 1.14.0 0.14.0
1.5.4 1.14.0 0.13.1

Modules

Module Purpose
backend-shared Shared compiler, asset, resource, and reflection support
backend-web libGDX web runtime plus JavaScript and Wasm build support
backend-glfw TeaVM C output for desktop GLFW native builds
backend-ios Experimental TeaVM C output and runtime support for iOS builds
backend-android TeaVM C output and runtime support for Android app modules
gdx-freetype-web FreeType support for TeaVM web builds
gdx-freetype-c FreeType support for TeaVM C native builds
gdx-controllers-web Controller support for TeaVM web builds
gdx-controllers-ios GameController support for TeaVM C iOS builds
tools/gdx-teavm-plugin Gradle plugin implementation

Documentation

Setup

Release artifacts are available from Maven Central. Snapshot and plugin repository configuration is documented once in the usage guide.

Gradle Plugin Quick Start

Apply the plugin in the TeaVM target module:

plugins {
    id("com.github.xpenatan.gdx-teavm") version "<latest-release>"
}

dependencies {
    implementation("com.badlogicgames.gdx:gdx:1.14.2")
    implementation(project(":core"))
}

gdxTeaVM {
    assets("assets")
    reflection("com.example.game.save**")

    js {
        mainClass.set("com.example.game.teavm.WebLauncher")
    }

    wasm {
        mainClass.set("com.example.game.teavm.WebLauncher")
    }
}

Run:

./gradlew gdx_teavm_web_js_run
./gradlew gdx_teavm_web_wasm_run

The web run tasks build the app, copy assets, generate the web app files, and serve the output with the backend Jetty server. The plugin adds the required gdx-teavm backend dependencies automatically for each declared target.

For native targets and every available property, see the usage guide and plugin property reference. The plugin creates tasks only for the target blocks you declare.

Manual Builder Quick Start

Use the builder API when you need full programmatic control or a custom build launcher. The manual builder guide contains dependencies and complete Web and GLFW examples.

Examples In This Repository

The examples index describes the project layout and links to the task inventory for each example.

Support

If this project is useful to you, consider sponsoring its development.

License

gdx-teavm is licensed under the Apache License 2.0.

Releases

Sponsor this project

Packages

Used by

Contributors

Languages