3dphotoshoot
diff src/android/amain.c @ 4:38377f54527a
having a whack at the camera api... at least the java crap compiles, we'll try calling it later
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Tue, 19 May 2015 06:05:51 +0300 |
parents | cf5964db7ff3 |
children | 31cc6615428d |
line diff
1.1 --- a/src/android/amain.c Fri May 15 05:15:47 2015 +0300 1.2 +++ b/src/android/amain.c Tue May 19 06:05:51 2015 +0300 1.3 @@ -26,24 +26,20 @@ 1.4 static JNIEnv *jni; 1.5 static jclass activity_class; 1.6 1.7 -static int call_foo(const char *s, int n) 1.8 +static int call_foo() 1.9 { 1.10 jmethodID foo_id; 1.11 - jstring jstr; 1.12 - int res; 1.13 1.14 printf("call_foo() [activity_class=%p]\n", (void*)activity_class); 1.15 1.16 - if(!(foo_id = (*jni)->GetStaticMethodID(jni, activity_class, "foo", "(Ljava/lang/String;I)I"))) { 1.17 + if(!(foo_id = (*jni)->GetStaticMethodID(jni, activity_class, "foo", "()V"))) { 1.18 fprintf(stderr, "static method foo not found\n"); 1.19 return -1; 1.20 } 1.21 1.22 - jstr = (*jni)->NewStringUTF(jni, s); 1.23 - res = (*jni)->CallStaticIntMethod(jni, activity_class, foo_id, jstr, n); 1.24 - (*jni)->DeleteLocalRef(jni, jstr); 1.25 + (*jni)->CallStaticIntMethod(jni, activity_class, foo_id); 1.26 1.27 - return res; 1.28 + return 0; 1.29 } 1.30 1.31 void android_main(struct android_app *app_ptr) 1.32 @@ -63,8 +59,6 @@ 1.33 } 1.34 activity_class = (*jni)->GetObjectClass(jni, app->activity->clazz); 1.35 1.36 - printf("JNI call returned: %d\n", call_foo("testing C->java jni calls", 42)); 1.37 - 1.38 for(;;) { 1.39 int num_events; 1.40 struct android_poll_source *pollsrc; 1.41 @@ -81,6 +75,7 @@ 1.42 } 1.43 1.44 if(init_done) { 1.45 + call_foo(); 1.46 game_display(get_time_msec()); 1.47 eglSwapBuffers(dpy, surf); 1.48 }