android/testproject/jni/app-android.cpp
changeset 4713 ba38983b10c2
parent 4712 8319aa8fa4dc
child 4714 0f05f2f16fad
equal deleted inserted replaced
4712:8319aa8fa4dc 4713:ba38983b10c2
    34 //method signatures
    34 //method signatures
    35 jmethodID midCreateGLContext;
    35 jmethodID midCreateGLContext;
    36 jmethodID midFlipBuffers;
    36 jmethodID midFlipBuffers;
    37 
    37 
    38 extern "C" int SDL_main();
    38 extern "C" int SDL_main();
       
    39 extern "C" int Android_OnKeyDown(int keycode);
       
    40 extern "C" int Android_OnKeyUp(int keycode);
    39 
    41 
    40 /*******************************************************************************
    42 /*******************************************************************************
    41                  Functions called by JNI
    43                  Functions called by JNI
    42 *******************************************************************************/	
    44 *******************************************************************************/	
    43 
    45 
    75     }
    77     }
    76     
    78     
    77     return JNI_VERSION_1_4;
    79     return JNI_VERSION_1_4;
    78 }
    80 }
    79 
    81 
       
    82 extern "C" void Java_org_libsdl_android_SDLActivity_onNativeKeyDown(JNIEnv*  env, 
       
    83                jobject obj, jint keycode){
       
    84     
       
    85     int r = Android_OnKeyDown(keycode);
       
    86     __android_log_print(ANDROID_LOG_INFO, "SDL", "SDL: native key down %d, %d\n", keycode, r);
       
    87 }
       
    88 
       
    89 extern "C" void Java_org_libsdl_android_SDLActivity_onNativeKeyUp(JNIEnv*  env, 
       
    90                jobject obj, jint keycode){
       
    91     
       
    92     int r = Android_OnKeyUp(keycode);
       
    93     __android_log_print(ANDROID_LOG_INFO, "SDL", "SDL: native key up %d, %d\n", keycode, r);
       
    94 }
       
    95 
    80 
    96 
    81 
    97 
    82 /*******************************************************************************
    98 /*******************************************************************************
    83                  Functions called by SDL
    99                  Functions called by SDL
    84 *******************************************************************************/
   100 *******************************************************************************/