Skip to content

noblemaster/gdx-teavm

 
 

Repository files navigation

Build

Sonatype Nexus (Snapshots) Sonatype Nexus (Snapshots)

gdx-teaVM is a backend solution to run libgdx games in a web browser. It uses TeaVM behind the scene to convert Java/Kotlin bytecode to Javascript.

Note:

  • Reflection support is very small so only reflection used in tests will work.
  • teaVM does not support every class methods from java package or JNI native methods. Check teaVM java classes here.
  • Kotlin discussions.
  • Box2d, Bullet and freetype extension use emscripten to convert C++ to Javascript/WebAssembly. Box2d and Bullet use a custom parser (jParser) to help bind javascript code.

TeaVM Examples:

TeaVM Games:

Setup:

// Add sonatype repository to Root gradle
repositories {
    maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
    maven { url "https://oss.sonatype.org/content/repositories/releases/" }
    maven { url "https://teavm.org/maven/repository/" }
}
gdxTeaVMVersion = "1.0.0-SNAPSHOT"
// In teaVM module
dependencies {
    implementation "com.github.xpenatan.gdx-teavm:backend-teavm:$project.gdxTeaVMVersion"

    // Bullet extension
    implementation "com.github.xpenatan.gdx-teavm:gdx-bullet-teavm:$project.gdxTeaVMVersion"
    // Box2D extension
    implementation "com.github.xpenatan.gdx-teavm:gdx-box2d-teavm:$project.gdxTeaVMVersion"
    // FreeType extension
    implementation "com.github.xpenatan.gdx-teavm:gdx-freetype-teavm:$project.gdxTeaVMVersion"
}

Supported Extensions:

  • Box2D (WIP)¹
  • Bullet Physics (WIP)²
  • FreeType

¹: Box2D extension is WIP, please check if the class/method your game use is in webidl file. If not, you can use gdx-box2d-gwt.
²: Bullet extension is WIP, please check if the class/method your game use is in webidl file. This extension does not support some custom c++ code from libgdx bullet.

Generator:

A WIP standalone tool to convert your libgdx game in .jar or .class format to javascript. Example

Note: The compiled jar game should not be obfuscated.

Setup: TODO

About

WIP. Libgdx Html5 solution in a single repository.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 77.2%
  • C 22.0%
  • CMake 0.3%
  • C++ 0.2%
  • HTML 0.1%
  • Batchfile 0.1%
  • Other 0.1%