gpt4 book ai didi

java - Cocos2d-x 中无法出现 'Hello World'

转载 作者:行者123 更新时间:2023-12-01 12:56:15 25 4
gpt4 key购买 nike

我正在尝试设置 Cocos2d-x 来进行一些游戏开发。创建默认的 Hello World 项目并将 Cocos2d-x 库导入 Eclipse 后,当我尝试在模拟器上运行该应用程序时,它崩溃了。请在这方面提供帮助。

我已在模拟器中启用了 GPU 模拟,并在 list 文件中添加了 OpenGLES 2.0 权限。

package com.toddperkins.MoleItx;
import org.cocos2dx.lib.Cocos2dxActivity;
import org.cocos2dx.lib.Cocos2dxGLSurfaceView;
import android.os.Bundle;

public class MoleItx extends Cocos2dxActivity{

protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
}

public Cocos2dxGLSurfaceView onCreateView() {
Cocos2dxGLSurfaceView glSurfaceView = new Cocos2dxGLSurfaceView(this);
// MoleItx should create stencil buffer
glSurfaceView.setEGLConfigChooser(5, 6, 5, 0, 16, 8);

return glSurfaceView;
}

static {
System.loadLibrary("cocos2dcpp");
}
}

日志猫:

`05-26 15:06:18.048: D/dalvikvm(453): Added shared lib/ data/data/com.toddperkins.MoleItx/lib/libcocos2dcpp.so 0x405132a8
05-26 15:06:18.246: D/Cocos2dxActivity(453): model=sdk
05-26 15:06:18.246: D/Cocos2dxActivity(453): product=sdk
05-26 15:06:18.246: D/Cocos2dxActivity(453): isEmulator=true
05-26 15:06:18.716: D/libEGL(453): egl.cfg not found, using default config
05-26 15:06:18.716: D/libEGL(453): loaded /system/lib/egl/libGLES_android.so
05-26 15:06:18.861: W/dalvikvm(453): threadid=9: thread exiting with uncaught exception (group=0x40015560)
05-26 15:06:18.866: E/AndroidRuntime(453): FATAL EXCEPTION: GLThread 10
05-26 15:06:18.866: E/AndroidRuntime(453): java.lang.IllegalArgumentException: No configs match configSpec
05-26 15:06:18.866: E/AndroidRuntime(453): at android.opengl.GLSurfaceView$BaseConfigChooser.chooseConfig(GLSurfaceView.java:763)
05-26 15:06:18.866: E/AndroidRuntime(453): at android.opengl.GLSurfaceView$EglHelper.start(GLSurfaceView.java:919)
05-26 15:06:18.866: E/AndroidRuntime(453): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1264)
05-26 15:06:18.866: E/AndroidRuntime(453): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1118)
05-26 15:11:19.011: I/Process(453): Sending signal. PID: 453 SIG: 9`

最佳答案

Petr StackOverflow 上的另一位 Cocos2d-x 用户通过 setting his GL configuration explicitly 解决了这个问题。 ,添加:

gLSurfaceView.setEGLConfigChooser(8 , 8, 8, 8, 16, 0);

之前

gLSurfaceView.setCocos2dxRenderer(new Cocos2dxRenderer());

关于java - Cocos2d-x 中无法出现 'Hello World',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23867322/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com