mirror of https://github.com/axmolengine/axmol.git
Handle evalScript from JNI. Also adds helpers for settings status
This commit is contained in:
parent
615329eee5
commit
eb85a6c1fb
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue