Kotlin Support

Hello, I’ve just published the first version of KMonkey: Kotlin tools for the JMonkey engine.

You can use the tools with ‘io.jackbradshaw:kmonkey:1.0.0’ and view the source on GitHub.

Right now the package is focussed on making coroutines easy to use. For example, you can run a coroutine on the main thread like this:

import io.jackbradshaw.kmonkey.coroutines.renderingDispatcher

class MyApplication : SimpleApplication {
  
  /* Snip: All the usual setup stuff. */
  
  private val worldItem by lazy { SomeWorldItem() }
  
  init {
    renderingDispatcher().launch {
      rootNode.attachChild(worldItem)
      for (i in 0..100) {
        delay(1000L) // 1 second
        worldItem.setLocalTranslation(Vector3f(i * 10, 0, 0))
      }
    }
  }
}

Other utils exist for the physics thread.

View the GitHub page for more utils, docs and examples.

9 Likes