Closed hilouki closed 7 years ago
这个问题可能和SLG实例使用多线程实现有关,我去掉了子线程以后ok了,但是原例子里面绘制行动范围,地图网格都是在子线程里draw以后通知主线程,去掉线程以后小白的我就不知道该怎么实现这些特性了。唉
经过不断的东搞西搞胡搞瞎搞终于解决了,简单的说就是这个SRPG的例子需要重构,里面还有不少bug。 Lgame还是蛮好用的(我用的0.41版),适合我这种没时间学c++的java小白,但是教程太少了,用的人也不多,有什么问题除了看实例(很多例子已经不适配新版的框架了,多少有些问题)只能自己看底层代码找原因。
如题,具体什么原因过两天我再仔细调一下。 错误如下: 02-18 19:31:31.963: E/AndroidRuntime(11254): FATAL EXCEPTION: main 02-18 19:31:31.963: E/AndroidRuntime(11254): Process: com.mygame, PID: 11254 02-18 19:31:31.963: E/AndroidRuntime(11254): java.lang.RuntimeException: Unable to pause activity {com.mygame/com.mygame.Main}: java.lang.IllegalArgumentException: buffer not allocated with newUnsafeByteBuffer or already disposed 02-18 19:31:31.963: E/AndroidRuntime(11254): at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3736) 02-18 19:31:31.963: E/AndroidRuntime(11254): at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3695) 02-18 19:31:31.963: E/AndroidRuntime(11254): at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:3670) 02-18 19:31:31.963: E/AndroidRuntime(11254): at android.app.ActivityThread.access$1100(ActivityThread.java:177) 02-18 19:31:31.963: E/AndroidRuntime(11254): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1466) 02-18 19:31:31.963: E/AndroidRuntime(11254): at android.os.Handler.dispatchMessage(Handler.java:102) 02-18 19:31:31.963: E/AndroidRuntime(11254): at android.os.Looper.loop(Looper.java:145) 02-18 19:31:31.963: E/AndroidRuntime(11254): at android.app.ActivityThread.main(ActivityThread.java:5942) 02-18 19:31:31.963: E/AndroidRuntime(11254): at java.lang.reflect.Method.invoke(Native Method) 02-18 19:31:31.963: E/AndroidRuntime(11254): at java.lang.reflect.Method.invoke(Method.java:372) 02-18 19:31:31.963: E/AndroidRuntime(11254): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400) 02-18 19:31:31.963: E/AndroidRuntime(11254): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195) 02-18 19:31:31.963: E/AndroidRuntime(11254): Caused by: java.lang.IllegalArgumentException: buffer not allocated with newUnsafeByteBuffer or already disposed 02-18 19:31:31.963: E/AndroidRuntime(11254): at loon.jni.NativeSupport.disposeUnsafeByteBuffer(NativeSupport.java:520) 02-18 19:31:31.963: E/AndroidRuntime(11254): at loon.core.graphics.opengl.LTextureBatch.dispose(LTextureBatch.java:1069) 02-18 19:31:31.963: E/AndroidRuntime(11254): at loon.core.graphics.opengl.LTextureBatch.destoryAll(LTextureBatch.java:1048) 02-18 19:31:31.963: E/AndroidRuntime(11254): at loon.core.graphics.opengl.LSTRFont.dispose(LSTRFont.java:472) 02-18 19:31:31.963: E/AndroidRuntime(11254): at loon.core.graphics.opengl.LSTRDictionary$Dict.dispose(LSTRDictionary.java:65) 02-18 19:31:31.963: E/AndroidRuntime(11254): at loon.core.graphics.opengl.LSTRDictionary.clearStringLazy(LSTRDictionary.java:85) 02-18 19:31:31.963: E/AndroidRuntime(11254): at loon.core.graphics.opengl.LSTRDictionary.dispose(LSTRDictionary.java:234) 02-18 19:31:31.963: E/AndroidRuntime(11254): at loon.core.graphics.opengl.LTextures.disposeAll(LTextures.java:209) 02-18 19:31:31.963: E/AndroidRuntime(11254): at loon.LProcess.onDestroy(LProcess.java:683) 02-18 19:31:31.963: E/AndroidRuntime(11254): at loon.AndroidView.destroy(AndroidView.java:400) 02-18 19:31:31.963: E/AndroidRuntime(11254): at loon.LGame.onPause(LGame.java:775) 02-18 19:31:31.963: E/AndroidRuntime(11254): at android.app.Activity.performPause(Activity.java:6446) 02-18 19:31:31.963: E/AndroidRuntime(11254): at android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1308) 02-18 19:31:31.963: E/AndroidRuntime(11254): at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3722) 02-18 19:31:31.963: E/AndroidRuntime(11254): ... 11 more