Libgdx - pixmap已经处理

时间:2016-04-16 10:33:16

标签: android libgdx

04-16 12:17:58.353 12029-12056/com.nisvol.squaresmash E/AndroidRuntime: FATAL EXCEPTION: GLThread 664
                                                                Process: com.nisvol.squaresmash, PID: 12029
                                                                com.badlogic.gdx.utils.GdxRuntimeException: Pixmap already disposed!
                                                                    at com.badlogic.gdx.graphics.Pixmap.dispose(Pixmap.java:315)
                                                                    at com.badlogic.gdx.graphics.g2d.PixmapPacker$Page$1.dispose(PixmapPacker.java:379)
                                                                    at com.badlogic.gdx.graphics.g2d.BitmapFont.dispose(BitmapFont.java:315)
                                                                    at com.nisvol.squaresmash.screens.GameScreen.dispose(GameScreen.java:306)
                                                                    at com.nisvol.squaresmash.screens.GameScreen.changeScreen(GameScreen.java:209)
                                                                    at com.nisvol.squaresmash.screens.GameScreen.update(GameScreen.java:168)
                                                                    at com.nisvol.squaresmash.screens.GameScreen.render(GameScreen.java:261)
                                                                    at com.badlogic.gdx.Game.render(Game.java:46)
                                                                    at com.nisvol.squaresmash.SquareSmash.render(SquareSmash.java:44)
                                                                    at com.badlogic.gdx.backends.android.AndroidGraphics.onDrawFrame(AndroidGraphics.java:474)
                                                                    at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1531)
                                                                    at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1248)
04-16 12:18:02.533 12029-12029/com.nisvol.squaresmash E/AndroidGraphics: waiting for pause synchronization took too long; assuming deadlock and killing

我知道这可能还不够,只是我的意思是错误。但问题是我的手机上的游戏运行良好,但后来我在旧手机上试了一下,游戏一直在崩溃。但奇怪的是,只有当我得分高于50左右时才会崩溃,之后它会在屏幕上进入游戏。

所以我开始游戏屏幕并玩游戏,获得高于50的分数(物体从天上掉下来,你必须收集它们,如果物体不在屏幕上则会被删除),当我来到屏幕上游戏它说:游戏停止工作......而你可以看到它说Pixmap已被处置???我不知道这意味着什么。

我在Game Screen中唯一处理的是一个FreeTypeFontGenerator,它无法连接到Game Over屏幕,因为我将它初始化为:

FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("font.ttf"));
FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter();
parameter.size = 40;
parameter.color = Color.BLACK;
showScore = generator.generateFont(parameter);
generator.dispose();

在Game Over Screen中我再次这样做。那可能是什么原因?

0 个答案:

没有答案