Rishav Sharan
06/01/2020, 7:59 PMDeactivated User
06/01/2020, 8:28 PMsuspend fun
https://github.com/korlibs/korge/blob/bc4cfa3914518e8588f1146eec6ea9bf76ca1095/korge/src/commonMain/kotlin/com/soywiz/korge/scene/Scene.kt#L75-L82
It is executed once the scene is set once. There you can place a loop or something if required or just return. But if the scene is changed, the kotlinx.corotuines Job
associated is cancelled and that suspending function is terminatedRishav Sharan
06/01/2020, 9:53 PMoverride suspend fun init(injector: AsyncInjector): Unit = injector.run {
as deprecated. should i be using it?
4. I still didn't fully understand how the engine works, from the docs. I am used to the callback based engines having load(), update() and draw() functions. sceneInit seems like the load() callback. but where does the code which runs every tick goes in? Is it the addupdatable function?Deactivated User
06/01/2020, 11:32 PMaddUpdater { ,,, }
method like shown here: https://github.com/korlibs/korge-samples/blob/1771b7ca7f4440e1a368ff4b441e97bf62e08b8d/sample-tilemap/src/commonMain/kotlin/main.kt#L31
To handle input, you can use an addUpdater, then use views.input.keys
or views.input.mouse
or use event-based callbacks:
mouse { up { … } down { … } }
keys { up(Key.LEFT) { … } }
Rishav Sharan
06/02/2020, 7:19 AM