讨论贴在这里这里,感谢@偶尔e网事同学.
在接入 sdk 的时候, 上层显示一个 sdk 的界面时, 整个屏幕就会快速闪烁, 十分影响体验.
解决方案,打开
$QUICK-COCOS2D-X/lib/cocos2d-x/cocos2dx/platform/android/java/src/org/cocos2dx/lib/Cocos2dxActivity.java
:
1.将 onResume
的this.mGLSurfaceView.onResume();
实现改为:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| public void onResume() { super.onResume();
this.setRenderMode(RENDERMODE_CONTINUOUSLY); this.queueEvent(new Runnable() { @Override public void run() { Cocos2dxGLSurfaceView.this.mCocos2dxRenderer.handleOnResume(); } });
}
|
2.将 onPause
的实现改为:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| @Override public void onPause() {
this.queueEvent(new Runnable() { @Override public void run() { Cocos2dxGLSurfaceView.this.mCocos2dxRenderer.handleOnPause(); } }); this.setRenderMode(RENDERMODE_WHEN_DIRTY); }
|