当前位置: 首页 > 知识库问答 >
问题:

Cocos2d-x v3.0:标签类崩溃

关志
2023-03-14

我的cocos2d-x项目是用v3制作的,我有一个问题。0测试版。我升级到v3。0rc2。我正在使用eclipse开发android项目。我使用genymotion模拟器。

我遇到了标签类问题。这是我设置标签的代码。

auto label = Label::createWithTTF("hogehoge", "fonts/Perfect Dark Zone.ttf", 40);
label->setPosition(Point(visibleSize.width/2, visibleSize.height/2));
this->addChild(label, HelloWorld::kText1, HelloWorld::kZOrderText);

这是日食的错误。

    05-11 14:46:32.446: D/cocos2d-x debug info(1442): {
    05-11 14:46:32.446: D/cocos2d-x debug info(1442):   gl.supports_vertex_array_object: false
    05-11 14:46:32.446: D/cocos2d-x debug info(1442):   gl.supports_BGRA8888: false
    05-11 14:46:32.446: D/cocos2d-x debug info(1442):   gl.supports_ATITC: false
    05-11 14:46:32.446: D/cocos2d-x debug info(1442):   gl.supports_S3TC: false
    05-11 14:46:32.446: D/cocos2d-x debug info(1442):   cocos2d.x.version: cocos2d-x 3.0
    05-11 14:46:32.446: D/cocos2d-x debug info(1442):   gl.supports_discard_framebuffer: false
    05-11 14:46:32.446: D/cocos2d-x debug info(1442):   cocos2d.x.compiled_with_profiler: false

    05-11 14:46:32.446: D/cocos2d-x debug info(1442):   gl.supports_PVRTC: false
    05-11 14:46:32.446: D/cocos2d-x debug info(1442):   cocos2d.x.build_type: DEBUG
    05-11 14:46:32.446: D/cocos2d-x debug info(1442):   gl.renderer: Android Emulator OpenGL ES Translator (Intel HD Graphics 5000 OpenGL Engine)
    05-11 14:46:32.446: D/cocos2d-x debug info(1442):   gl.supports_ETC1: true
    05-11 14:46:32.446: D/cocos2d-x debug info(1442):   cocos2d.x.compiled_with_gl_state_cache: true
    05-11 14:46:32.446: D/cocos2d-x debug info(1442):   gl.version: OpenGL ES 2.0 (2.1 INTEL-8.24.12)
    05-11 14:46:32.446: D/cocos2d-x debug info(1442):   gl.supports_NPOT: true
    05-11 14:46:32.446: D/cocos2d-x debug info(1442):   gl.max_texture_units: 16
    05-11 14:46:32.446: D/cocos2d-x debug info(1442):   gl.vendor: Google (Intel Inc.)
    05-11 14:46:32.446: D/cocos2d-x debug info(1442):   gl.max_texture_size: 16384
    05-11 14:46:32.446: D/cocos2d-x debug info(1442): }
    05-11 14:46:32.522: I/ActivityManager(539): Displayed com.kn.gravity/org.cocos2dx.cpp.AppActivity: +263ms
    05-11 14:46:32.782: D/main(1442): cocos_android_app_init
    05-11 14:46:32.782: D/CCFileUtilsAndroid.cpp(1442): relative path = CloseNormal.png
    05-11 14:46:32.786: D/CCFileUtilsAndroid.cpp(1442): relative path = CloseSelected.png
    05-11 14:46:32.786: A/libc(1442): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 1455 (Thread-102)
    05-11 14:46:32.890: I/DEBUG(106): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
    05-11 14:46:32.890: I/DEBUG(106): Build fingerprint: 'generic/vbox86tp/vbox86tp:4.4.2/KOT49H/eng.buildbot.20140326.034346:userdebug/test-keys'
    05-11 14:46:32.890: I/DEBUG(106): Revision: '0'
    05-11 14:46:32.890: I/DEBUG(106): pid: 1442, tid: 1455, name: Thread-102  >>> com.kn.gravity 
    05-11 14:46:33.078: I/DEBUG(106):     #11  pc 0003b962  /system/lib/libdvm.so (dvmMterpStd(Thread*)+66)
    05-11 14:46:33.078: I/DEBUG(106):     #12  pc 00037029  /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+217)
    05-11 14:46:33.078: I/DEBUG(106):     #13  pc 000bd097  /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, char*)+759)
    05-11 14:46:33.078: I/DEBUG(106):     #14  pc 000bd4a7  /system/lib/libdvm.so (dvmCallMethod(Thread*, Method const*, Object*, JValue*, ...)+55)
    05-11 14:46:33.078: I/DEBUG(106):     #15  pc 00099433  /system/lib/libdvm.so (interpThreadStart(void*)+995)
    05-11 14:46:33.078: I/DEBUG(106):     #16  pc 0000bc7c  /system/lib/libc.so (__thread_entry+236)
    05-11 14:46:33.078: I/DEBUG(106):     #17  pc 0003e295  /system/lib/libc.so (__pthread_clone+69)
    05-11 14:46:33.078: I/DEBUG(106):     #18  pc 0009904f  /system/lib/libdvm.so (internalThreadStart(void*)+655)
    05-11 14:46:33.078: I/DEBUG(106):     #19  pc ffffffff  
    05-11 14:46:33.078: I/DEBUG(106):     #20  pc 000005ae  
    05-11 14:46:33.078: I/DEBUG(106):     #21  pc 00000022  
    05-11 14:46:33.078: I/DEBUG(106):     #22  pc 0003bbdf  /system/lib/libbinder.so
    05-11 14:46:33.078: I/DEBUG(106):     #23  pc 00012eaf  /system/lib/libutils.so
    05-11 14:46:33.078: I/DEBUG(106):     #24  pc 00012ebf  /system/lib/libutils.so
    05-11 14:46:33.078: I/DEBUG(106):     #25  pc ffffffff  
    05-11 14:46:33.078: I/DEBUG(106): stack:
    05-11 14:46:33.078: I/DEBUG(106):          95895800  b8bc67b0  [heap]
    05-11 14:46:33.078: I/DEBUG(106):          95895804  b8bc6338  [heap]
    05-11 14:46:33.078: I/DEBUG(106):          95895808  95655bb9  /data/app-lib/com.kn.gravity-1/libcocos2dcpp.so
    05-11 14:46:33.078: I/DEBUG(106):          9589580c  9577eb90  /data/app-lib/com.kn.gravity-1/libcocos2dcpp.so
    05-11 14:46:33.078: I/DEBUG(106):          95895810  956823b0  /data/app-lib/com.kn.gravity-1/libcocos2dcpp.so
    05-11 14:46:33.078: I/DEBUG(106):          95895814  95614586  /data/app-lib/com.kn.gravity-1/libcocos2dcpp.so (operator delete(void*)+6)
    05-11 14:46:33.078: I/DEBUG(106):          95895818  9577eb90  /data/app-lib/com.kn.gravity-1/libcocos2dcpp.so
    05-11 14:46:33.078: I/DEBUG(106):          9589581c  95653fbc  /data/app-lib/com.kn.gravity-1/libcocos2dcpp.so
    05-11 14:46:33.078: I/DEBUG(106):          95895820  b8bc67b0  [heap]
    05-11 14:46:33.078: I/DEBUG(106):          95895824  956823b8  /data/app-lib/com.kn.gravity-1/libcocos2dcpp.so
    05-11 14:46:33.078: I/DEBUG(106):          95895828  953a204b  /data/app-lib/com.kn.gravity-1/libcocos2dcpp.so (cocos2d::Label::createWithTTF(std::string const&, std::string const&, float, cocos2d::Size const&, cocos2d::TextHAlignment, cocos2d::TextVAlignment)+11)
    05-11 14:46:33.078: I/DEBUG(106):          9589582c  9577eb90  /data/app-lib/com.kn.gravity-1/libcocos2dcpp.so
    05-11 14:46:33.078: I/DEBUG(106):          95895830  95895890  [stack:1455]
    05-11 14:46:33.078: I/DEBUG(106):          95895834  95653fa6  /data/app-lib/com.kn.gravity-1/libcocos2dcpp.so
    05-11 14:46:33.078: I/DEBUG(106):          95895838  9577eb90  /data/app-lib/com.kn.gravity-1/libcocos2dcpp.so
    05-11 14:46:33.078: I/DEBUG(106):          9589583c  95350f29  /data/app-lib/com.kn.gravity-1/libcocos2dcpp.so (HelloWorld::init()+1145)
    05-11 14:46:33.078: I/DEBUG(106):     #00  95895840  b8bc67b0  [heap]
    05-11 14:46:33.078: I/DEBUG(106):          95895844  95895890  [stack:1455]
    05-11 14:46:33.078: I/DEBUG(106):          95895848  42200000  
    05-11 14:46:33.078: I/DEBUG(106):          9589584c  9578a724  
    05-11 14:46:33.078: I/DEBUG(106):          95895850  00000000  
    05-11 14:46:33.078: I/DEBUG(106):          95895854  00000000  
    05-11 14:46:33.078: I/DEBUG(106):          95895858  953b7760  /data/app-lib/com.kn.gravity-1/libcocos2dcpp.so (cocos2d::Node::setPosition(cocos2d::Point const&))
    05-11 14:46:33.078: I/DEBUG(106):          9589585c  44480000  
    05-11 14:46:33.082: I/DEBUG(106):          95895860  9589588e  [stack:1455]
    05-11 14:46:33.082: I/DEBUG(106):          95895864  9589588d  [stack:1455]
    05-11 14:46:33.082: I/DEBUG(106):          95895868  95895890  [stack:1455]
    05-11 14:46:33.082: I/DEBUG(106):          9589586c  9589588f  [stack:1455]
    05-11 14:46:33.082: I/DEBUG(106):          95895870  958958a4  [stack:1455]
    05-11 14:46:33.082: I/DEBUG(106):          95895874  41a00000  
    05-11 14:46:33.082: I/DEBUG(106):          95895878  01000000  
    05-11 14:46:33.082: I/DEBUG(106):          9589587c  b8bc57c8  [heap]
    05-11 14:46:33.082: I/DEBUG(106):          ........  ........
    05-11 14:46:33.082: I/DEBUG(106):     #01  958958e0  b8bc57c8  [heap]
    05-11 14:46:33.082: I/DEBUG(106):          958958e4  9577eb90  /data/app-lib/com.kn.gravity-1/libcocos2dcpp.so
    05-11 14:46:33.082: I/DEBUG(106):          958958e8  b8b90390  [heap]
    05-11 14:46:33.082: I/DEBUG(106):          958958ec  9537c65d  /data/app-lib/com.kn.gravity-1/libcocos2dcpp.so (cocos2d::DisplayLinkDirector::setAnimationInterval(double)+45)
    05-11 14:46:33.082: I/DEBUG(106):          958958f0  b8b90390  [heap]
    05-11 14:46:33.082: I/DEBUG(106):          958958f4  b8ba80d0  [heap]
    05-11 14:46:33.082: I/DEBUG(106):          958958f8  95350f69  /data/app-lib/com.kn.gravity-1/libcocos2dcpp.so (HelloWorld::createScene()+9)
    05-11 14:46:33.082: I/DEBUG(106):          958958fc  9577eb90  /data/app-lib/com.kn.gravity-1/libcocos2dcpp.so
    05-11 14:46:33.082: I/DEBUG(106):          95895900  b8b90390  [heap]
    05-11 14:46:33.082: I/DEBUG(106):          95895904  b8ba80d0  [heap]
    05-11 14:46:33.082: I/DEBUG(106):          95895908  958959f8  [stack:1455]
    05-11 14:46:33.082: I/DEBUG(106):          9589590c  953503ef  /data/app-lib/com.kn.gravity-1/libcocos2dcpp.so (AppDelegate::applicationDidFinishLaunching()+63)
    05-11 14:46:33.082: I/DEBUG(106):     #02  95895910  b8b90390  [heap]
    05-11 14:46:33.082: I/DEBUG(106):          95895914  11111111  
    05-11 14:46:33.082: I/DEBUG(106):          95895918  3f911111  
    05-11 14:46:33.082: I/DEBUG(106):          9589591c  953504ad  /data/app-lib/com.kn.gravity-1/libcocos2dcpp.so (AppDelegate::AppDelegate()+29)
    05-11 14:46:33.082: I/DEBUG(106):          95895920  b8ba3fd0  [heap]
    05-11 14:46:33.082: I/DEBUG(106):          95895924  9577eb90  /data/app-lib/com.kn.gravity-1/libcocos2dcpp.so
    05-11 14:46:33.082: I/DEBUG(106):          95895928  b77a07a9  /system/lib/liblog.so (__android_log_print+9)
    05-11 14:46:33.082: I/DEBUG(106):          9589592c  953503b8  /data/app-lib/com.kn.gravity-1/libcocos2dcpp.so (AppDelegate::applicationDidFinishLaunching()+8)
    05-11 14:46:33.082: I/DEBUG(106):          95895930  9577eb90  /data/app-lib/com.kn.gravity-1/libcocos2dcpp.so
    05-11 14:46:33.082: I/DEBUG(106):          95895934  b8b90390  [heap]
    05-11 14:46:33.082: I/DEBUG(106):          95895938  b8ba80d0  [heap]
    05-11 14:46:33.082: I/DEBUG(106):          9589593c  9550c580  /data/app-lib/com.kn.gravity-1/libcocos2dcpp

.so (cocos2d::Application::run()+16)

请帮助我。

共有3个答案

东郭瀚玥
2023-03-14

试试这个

 auto label = Label::createWithTTF("hogehoge", "Perfect Dark Zone.ttf", 40);
        label->setPosition(Point(visibleSize.width/2, visibleSize.height/2));
        this->addChild(label,1);
那博瀚
2023-03-14

我也遇到了同样的问题,并通过从fontName参数中删除路径来修复它。

尝试

“完美的黑暗地带。ttf”

而不是

"字体/完美黑暗Zone.ttf"

佴德曜
2023-03-14

如何声明标签在全球类(helloworld. h)与cocos2d-x v3.2?

首先在资产文件夹中添加fount。

像这样使用ios

"Perfect Dark Zone.ttf"

像这样使用android

"Perfect Dark Zone"
 类似资料:
  • 每当我做一个我的程序就会崩溃。我已经添加了JavaFX lib,我可以使用其他JavaFX组件,如,,,。我目前运行在JavaFx 13上,但我也尝试了JavaFX 11。 这是我在制作

  • subCategories标签 版本5.0.170927 新增 标签名 作用 包含属性 subCategories 获取指定分类下的子分类 categoryId ,item 标签属性: | 标签属性名 | 含义 | | --- | --- | | categoryId | 父级分类 id| | item | 循环变量,默认 vo | 代码演示 <portal:subCategories categ

  • categories标签 版本5.0.170927 新增 标签名 作用 包含属性 categories 获取文章分类列表 where,order,item 标签属性: | 标签属性名 | 含义 | | --- | --- | | where | 查询条件变量, 支持数组和字符串,如$where | | order | 排序方式 | | item | 循环变量,默认 vo | 获取所有文章分类 <p

  • cocos2d 是一个 Python 用来开发 2D 游戏和其他图形化交互应用的框架。提供多种语言版本。 主要特性 界面流程控制: Manage the flow control between different scenes in an easy way 精灵: Fast and easy sprites 动作: Just tell sprites what you want them to

  • Apk在升级和添加另一个模块后与旧版本运行良好,我得到了这个错误 这是我的proguard规则,我已经定义了应用程序的前一个版本,运行良好,我添加了新的东西,但没有什么可以帮助我,任何人可以帮助这个问题,我被困在过去几天。

  • allSubCategories标签 版本5.0.170927 新增 标签名 作用 包含属性 allSubCategories 获取指定分类下的所有子分类 categoryId ,item 标签属性: | 标签属性名 | 含义 | | --- | --- | | categoryId | 父级分类 id| | item | 循环变量,默认 vo | 代码演示 <portal:allSubCateg