From e43d7b07e0b06a8725961b9d5435ccb714321d85 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Thu, 3 Mar 2011 00:07:23 +0000 Subject: [PATCH] android: JNI hooks for single touch input. --- src/androidapp.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/androidapp.cpp b/src/androidapp.cpp index f01e38eb..1feacea9 100644 --- a/src/androidapp.cpp +++ b/src/androidapp.cpp @@ -69,6 +69,27 @@ Java_org_zoy_LolEngine_LolGLSurfaceView_nativePause(JNIEnv* env) /* TODO: unimplemented */ } +extern "C" void +Java_org_zoy_LolEngine_LolGLSurfaceView_nativeDown(JNIEnv* env) +{ + Input::SetMouseButton(0); +} + +extern "C" void +Java_org_zoy_LolEngine_LolGLSurfaceView_nativeUp(JNIEnv* env) +{ + Input::UnsetMouseButton(0); +} + +extern "C" void +Java_org_zoy_LolEngine_LolGLSurfaceView_nativeMove(JNIEnv* env, jobject thiz, + jint x, jint y) +{ + vec2i pos(x * 640 / Video::GetWidth(), + 480 - 1 - y * 480 / Video::GetHeight()); + Input::SetMousePos(pos); +} + /* Call to render the next GL frame */ extern "C" void Java_org_zoy_LolEngine_LolRenderer_nativeRender(JNIEnv* env)