Create games and apps with Kotlin.
- Precondition
- Kotlin is only supported in HTML5 platfoms exclusively with WebAssembly (wasmoon), it cannot be build with
--fengari
flag.
Applications made in kotlin with gly engine API can be used on HTML5 platforms like WebOS and Tizen.
- Tutorial
- Step 2
Create a folder named src/main/kotlin
and add a file called App.kt
or Game.kt
.
Inside the file, define a class with the same name and annotate it with @JsExport
.
- Step 3
Run the following command to build the project: gradle build
- Step 4
If there are no errors, the compiled output will be located in the dist/
folder.
- Template
import kotlin.js.JsExport
@JsExport
class Game {
fun init(std: dynamic) {
}
fun loop(std: dynamic) {
}
fun draw(std: dynamic) {
}
}
}