I have completed my gameplay section of my game and now i am working on facebook integration with cocos2dx. I have successfully integrated facebook with cocos2dx, i.e. i can call facbook features(ex inviting friends, sharing , posting scores etc) using JNI...
but the problem i am facing is that i cannot call any c++ function from java.
i am facing similar problem as mentioned in the link below: Calling C++(cocos2dx) method from java(android) for my in-app billing
i have also read the tutorial given in the forum: http://www.cocos2d-x.org/wiki/How_to_use_jni
and also: http://purplelilgirl.tumblr.com/post/54583532324/code-bit-how-to-use-jni-in-cocos2dx-android
Although i have read the above tutorials but it is still not very much clear to me about how to get started with it. can any one provide me with a detailed help....
java call c not c++ , so you need
java code(call jniPrintSomething(0) when you need):
public static native int jniPrintSomething(int val);
cpp code:
extern "C" {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
jint Java_org_reanix_bubbleshooter_BubbleShooter_jniPrintSomething(JNIEnv *env, jobject obj,jint val){
return 0;
}
#endif
}