2014-05-11 92 views
0

我的cocos2d-x項目是由v3.0 beta製作的。 我升級到v3.0rc2。 我使用eclipse開發android項目。 我使用genymotion模擬器。cocos2d-x v3.0:使用標籤類崩潰

我遇到了Label類的問題。 繼承人我的代碼來設置標籤。

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) 

請幫幫我。

+0

你真的應該升級到V3決賽後。很多修復。 – GameDeveloper

+0

我升級到v3 final.but相同的logcat錯誤... – kazuki

回答

0

我有同樣的問題,並通過從fontName參數中刪除路徑來修復它。

嘗試

「完美黑暗Zone.ttf」

,而不是

「字型/完美黑暗Zone.ttf」

0

試試這個

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

我即將失去它的人!嘗試尊重字體名稱(大寫字母等)的確切格式,這裏是我之前的代碼

cocos2d::Label* gameOver = cocos2d::Label::createWithTTF("OVER!", "fonts/Roboto-Light.TTF", 26 * fratio); 

嘗試這種

cocos2d::Label* gameOver = cocos2d::Label::createWithTTF("OVER!", "fonts/Roboto-Light.ttf", 26 * fratio); 

它工作得很好