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;>getWinSize;
}
//HelloWorldScene.cpp
void HelloWorld::addLabel{
CCLog;
CCSize size=CCDirector::sharedDirector
CCLabelTTF* Testlabel=CCLabelTTF::create;
Testlabel~~>setColor);
Testlabel~~>setPosition(ccp(size.width/2,size.height/4*3));
CCLog(“label position:————%2.1f”,Testlabel~~>getPosition.x);
this~~>addChild(Testlabel,2);
}
so,I run this,I can get the “java call c++ success” message,but this is no CCLabelTTF in my android screen, why i can’t get the right result……please help !