Handle evalScript from JNI. Also adds helpers for settings status

This commit is contained in:
Rohan Kuruvilla 2013-04-26 13:44:39 -07:00
parent 615329eee5
commit eb85a6c1fb
1 changed files with 39 additions and 0 deletions

View File

@ -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();