add callback for loading geode

This commit is contained in:
qimiko committed 2023-06-05 16:33:21 -07:00
1 parent 219c6e8d07
commit c94bb86af1
2 files changed
+16

No files matched your search

@@ -0,0 +1,9 @@
package com.geode.launcher
object Native {
var isInitRun = false
var isGeodeLoaded = false
@JvmStatic
external fun postGameInit()
}
@@ -1,6 +1,7 @@
package org.cocos2dx.lib
import android.opengl.GLSurfaceView
import com.geode.launcher.Native
import javax.microedition.khronos.egl.EGLConfig
import javax.microedition.khronos.opengles.GL10
@@ -67,6 +68,12 @@ class Cocos2dxRenderer : GLSurfaceView.Renderer {
override fun onSurfaceCreated(gl10: GL10?, eglConfig: EGLConfig?) {
nativeInit(screenWidth, screenHeight)
if (Native.isGeodeLoaded && !Native.isInitRun) {
Native.postGameInit()
Native.isInitRun = true
}
lastTickInNanoSeconds = System.nanoTime()
}