android - CCGLSurfaceView 错误

标签 android cocos2d-android

我正在开发一些示例代码。 我在使用 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/

相关文章:

java - 根据系统时间每30秒更新一次listView的正确方法

java - 如何在 cocos2d android 1 中创建 cocos2d 粒子效果?

android - Cocos2d Android CCRenderTexture 示例

android - Cocos2d : Activity class & CCLayer class

java - 如何在Android(JAVA版)中使用Cocos2D实现Sprite Animation?

android - OpenGL ES 2.0 : How to render to a frameBuffer in a lower resolution for environment mapping?

android - 使用 BottomAppBar Material 设计组件的 fragment 过渡

android - 使用JNI,还是不使用JNI(Android性能)

Android Studio 单元测试 : unable to find instrumentation OR class not found ex

android - 在哪里可以找到使用 Cocos2D-x 开始编程的好教程?