From ed3d51f00ccbd231d9bd9c4e438978a916559073 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Thu, 18 Aug 2011 06:44:35 +0000 Subject: [PATCH] android: implement JNI_OnLoad and use Log::Info instead of the native Android functions. --- src/androidapp.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/androidapp.cpp b/src/androidapp.cpp index 7f233d11..d8cd4ccf 100644 --- a/src/androidapp.cpp +++ b/src/androidapp.cpp @@ -29,6 +29,12 @@ jobject g_ctx; JNIEnv *g_env; }; +extern "C" jint +JNI_OnLoad(JavaVM* vm, void* reserved) +{ + return JNI_VERSION_1_4; +} + extern "C" void Java_org_zoy_LolEngine_LolActivity_nativeInit(JNIEnv* env, jobject thiz) { @@ -39,9 +45,11 @@ Java_org_zoy_LolEngine_LolActivity_nativeInit(JNIEnv* env, jobject thiz) extern "C" void Java_org_zoy_LolEngine_LolRenderer_nativeInit(JNIEnv* env) { + /* We cannot use JNI_OnLoad for this because we're in a different + * thread now. */ g_env = env; - __android_log_print(ANDROID_LOG_INFO, "LOL", "init"); + Log::Info("initialising renderer"); Ticker::Setup(30.0f); Video::Setup(vec2i(320, 200)); @@ -53,7 +61,7 @@ extern "C" void Java_org_zoy_LolEngine_LolRenderer_nativeResize(JNIEnv* env, jobject thiz, jint w, jint h) { - __android_log_print(ANDROID_LOG_INFO, "LOL", "resize w=%d h=%d", w, h); + Log::Info("resizing to %i x %i", w, h); Video::Setup(vec2i(w, h)); }