gdx-teavm is a backend solution for running libGDX games directly in web browsers. It leverages TeaVM, a tool that compiles Java or Kotlin bytecode into JavaScript or WebAssembly, enabling seamless execution of game logic within the browser environment without needing additional plugins or complex setup. Additionally, gdx-teavm incorporates Emscripten to handle some of the Java Native Interface (JNI) code, allowing for the execution of specific internal functions that require native performance.
For updated examples on how to run, see the examples module in this repository.
The gdx-teavm-examples is an external repository that may not reflect the latest updates.
If you find this project valuable and want to fuel its continued growth, please consider sponsoring it. Your support keeps the momentum going!
| gdx-teavm | LibGDX | TeaVM |
|---|---|---|
| -SNAPSHOT | 1.14.0 | 0.13.1 |
| 1.5.3 | 1.14.0 | 0.13.1 |
| 1.5.2 | 1.14.0 | 0.13.1 |
| 1.5.1 | 1.14.0 | 0.13.0 |
// Add sonatype repository to Root gradle
repositories {
mavenCentral()
maven { url = uri("https://central.sonatype.com/repository/maven-snapshots/") }
// If there is a problem with the teavm repository, you can try using http
maven {
url = uri("http://teavm.org/maven/repository/")
isAllowInsecureProtocol = true
}
}
// Version
gdxTeaVMVersion = "-SNAPSHOT"
gdxTeaVMVersion = "[LAST_TAG_VERSION]"
// In teaVM module
dependencies {
implementation "com.github.xpenatan.gdx-teavm:backend-web:$project.gdxTeaVMVersion"
// FreeType extension
implementation "com.github.xpenatan.gdx-teavm:gdx-freetype-teavm:$project.gdxTeaVMVersion"
// gdx-controllers extension
implementation "com.github.xpenatan.gdx-teavm:gdx-controllers-teavm:$project.gdxTeaVMVersion"
}