java code:
Cocos2d-xRenderer.java
public void onDrawFrame(final GL10 gl){
…
Cocos2dxRenderer.nativeRender();
Cocos2dxRenderer.nativeAddLabel();
…
} private static native void nativeAddLabel();
/////
void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeAddLabel(JNIEnv* env, jobject thiz){
HelloWorld::Instance()->addLabel();
}
//HelloWorldScene.cpp
void HelloWorld::addLabel(){
CCLog(“java call c++ success!!!”);
CCSize size=CCDirector::sharedDirector()->getWinSize();
CCLabelTTF* Testlabel=CCLabelTTF::create(“Java call C++ success!!!”, “Thonburi”, 50);
Testlabel->setColor(ccc3(0, 200, 0));
Testlabel->setPosition(ccp(size.width/2,size.height/4*3));
CCLog(“label position:------------%2.1f”,Testlabel->getPosition().x); this->addChild(Testlabel,2); }
可以成功打印出java call c++ success 但是,Android屏幕中没有TestLabel显示的内容,为什么,求大神解释啊。。。。。。。