forked from geode-sdk/android-launcher
make cocos2dxhelper static
This commit is contained in:
1 file changed
+10
-13
@@ -1,14 +1,12 @@
|
||||
package org.cocos2dx.lib
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.content.pm.ApplicationInfo
|
||||
import android.os.Process
|
||||
|
||||
|
||||
@Suppress("unused")
|
||||
class Cocos2dxHelper {
|
||||
companion object {
|
||||
@Suppress("unused", "KotlinJniMissingFunction")
|
||||
object Cocos2dxHelper {
|
||||
// private val sCocos2dMusic: Cocos2dxMusic? = null
|
||||
// private val sCocos2dSound: Cocos2dxSound? = null
|
||||
// private val sAssetManager: AssetManager? = null
|
||||
@@ -16,8 +14,8 @@ class Cocos2dxHelper {
|
||||
// private val sAccelerometerEnabled = false
|
||||
private var sPackageName: String? = null
|
||||
private var sFileDirectory: String? = null
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private var sContext: Context? = null
|
||||
|
||||
// private var sContext: Context? = null
|
||||
private var sCocos2dxHelperListener: Cocos2dxHelperListener? = null
|
||||
|
||||
@JvmStatic
|
||||
@@ -31,9 +29,14 @@ class Cocos2dxHelper {
|
||||
return sFileDirectory
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun terminateProcess() {
|
||||
Process.killProcess(Process.myPid())
|
||||
}
|
||||
|
||||
fun init(pContext: Context, pCocos2dxHelperListener: Cocos2dxHelperListener) {
|
||||
val applicationInfo: ApplicationInfo = pContext.applicationInfo
|
||||
sContext = pContext
|
||||
// sContext = pContext
|
||||
sCocos2dxHelperListener = pCocos2dxHelperListener
|
||||
sPackageName = applicationInfo.packageName
|
||||
sFileDirectory = pContext.filesDir.absolutePath
|
||||
@@ -51,12 +54,6 @@ class Cocos2dxHelper {
|
||||
// Cocos2dxETCLoader.setContext(pContext)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun terminateProcess() {
|
||||
Process.killProcess(Process.myPid())
|
||||
}
|
||||
}
|
||||
|
||||
interface Cocos2dxHelperListener {
|
||||
fun runOnGLThread(pRunnable: Runnable)
|
||||
|
||||
|
||||
Reference in new issue
Block a user