Browse Source

android: implement JNI_OnLoad and use Log::Info instead of the native

Android functions.
legacy
Sam Hocevar sam 13 years ago
parent
commit
ed3d51f00c
1 changed files with 10 additions and 2 deletions
  1. +10
    -2
      src/androidapp.cpp

+ 10
- 2
src/androidapp.cpp View File

@@ -29,6 +29,12 @@ jobject g_ctx;
JNIEnv *g_env; JNIEnv *g_env;
}; };


extern "C" jint
JNI_OnLoad(JavaVM* vm, void* reserved)
{
return JNI_VERSION_1_4;
}

extern "C" void extern "C" void
Java_org_zoy_LolEngine_LolActivity_nativeInit(JNIEnv* env, jobject thiz) 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 extern "C" void
Java_org_zoy_LolEngine_LolRenderer_nativeInit(JNIEnv* env) 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; g_env = env;


__android_log_print(ANDROID_LOG_INFO, "LOL", "init");
Log::Info("initialising renderer");
Ticker::Setup(30.0f); Ticker::Setup(30.0f);
Video::Setup(vec2i(320, 200)); Video::Setup(vec2i(320, 200));


@@ -53,7 +61,7 @@ extern "C" void
Java_org_zoy_LolEngine_LolRenderer_nativeResize(JNIEnv* env, jobject thiz, Java_org_zoy_LolEngine_LolRenderer_nativeResize(JNIEnv* env, jobject thiz,
jint w, jint h) 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)); Video::Setup(vec2i(w, h));
} }




Loading…
Cancel
Save