diff --git a/samples/Javascript/CocosPlayer/proj.android/jni/cocosplayer/main.cpp b/samples/Javascript/CocosPlayer/proj.android/jni/cocosplayer/main.cpp index ea9f6745cf..91a24d1136 100644 --- a/samples/Javascript/CocosPlayer/proj.android/jni/cocosplayer/main.cpp +++ b/samples/Javascript/CocosPlayer/proj.android/jni/cocosplayer/main.cpp @@ -65,14 +65,53 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi void Java_org_cocos2dx_cocosplayer_CocosPlayerSocket_nativeStopCCB(JNIEnv* env, jobject thiz) { LOGD("INSIDE JNI STOP CALL"); + setOrientationJNI(1); handle_ccb_stop(); } void Java_org_cocos2dx_cocosplayer_CocosPlayerSocket_nativeRunScript(JNIEnv* env, jobject thiz, jstring jsString) { + + std::string scriptStr; + if (!jsString) { + return; + } + + const char *s = env->GetStringUTFChars(jsString,NULL); + scriptStr = s; + env->ReleaseStringUTFChars(jsString,s); + jsval out; + handle_eval_script(scriptStr.c_str(), &out); LOGD("INSIDE JNI RUN SCRIPT CALL"); } + void Java_org_cocos2dx_cocosplayer_CocosPlayerSocket_nativeConnectionStatus(JNIEnv* env, jobject thiz, jstring jMsg) { + + std::string msg; + if (!jMsg) { + return; + } + + const char *s = env->GetStringUTFChars(jMsg,NULL); + msg = s; + env->ReleaseStringUTFChars(jMsg,s); + handle_set_status(msg.c_str()); + } + + void Java_org_cocos2dx_cocosplayer_CocosPlayerSocket_nativeStatus(JNIEnv* env, jobject thiz, jstring jMsg) + { + std::string msg; + if (!jMsg) { + return; + } + + const char *s = env->GetStringUTFChars(jMsg,NULL); + msg = s; + env->ReleaseStringUTFChars(jMsg,s); + handle_set_message(msg.c_str()); + } + + void Java_org_cocos2dx_cocosplayer_CocosPlayerSocket_nativeConnected(JNIEnv* env, jobject thiz) { handle_connected();