我正在开发一些示例代码。 我在使用 cocos2d 时遇到了一些问题。 那就是 CCGLSurfaceView 的问题。
首先,我在我的项目中导入了 cocos2d.jar 和 fps_images.png 文件。 我修改了我的项目以使用 cocos2d 库。
这是代码。
public class ToadActivity extends Activity {
protected CCGLSurfaceView _glSurfaceView;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON, WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
_glSurfaceView = new CCGLSurfaceView(this);
setContentView(_glSurfaceView);
}
@Override
public void onStart()
{
super.onStart();
CCDirector.sharedDirector().attachInView(_glSurfaceView);
CCDirector.sharedDirector().setDisplayFPS(true);
CCDirector.sharedDirector().setAnimationInterval(1.0f / 60.0f);
}
}
==>>> _glSurfaceView = new CCGLSurfaceView(this);
在这里,我的应用程序发现了一个错误。结果,它在我的安卓模拟器中被杀死了。 有什么问题?
最佳答案
该库已被删除,不再更新。最好开始使用:http://www.cocos2d-x.org/ .它使用 c++,在 android 上工作,使用 JNI( native 代码)。代码可以移植到其他平台,例如 IO。
希望对您有所帮助!
关于android - CCGLSurfaceView 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10679602/