[DEV] fixes the compatibility with the java code... not tested...

This commit is contained in:
Keidan (K. Billonneau) 2013-07-10 19:07:03 +02:00
parent 59483ab23b
commit 0df2c89ed0

View File

@ -1,16 +1,5 @@
/** /**
* @author Edouard DUPIN * @author Edouard DUPIN, Kevin BILLONNEAU
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
// this include a dynamic generating file ==> this is really stupid, but it is needed for the dependency coherency
//#include <ewol/renderer/os/gui.Android.tmp.cpp>
/**
* @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved
* *
@ -27,15 +16,18 @@
#include <ewol/renderer/audio/audio.h> #include <ewol/renderer/audio/audio.h>
#include <ewol/renderer/os/gui.h> #include <ewol/renderer/os/gui.h>
#include <ewol/Dimension.h> #include <ewol/Dimension.h>
/* include auto generated file */
#include <ewol/renderer/os/org_ewol_EwolConstants.h>
// get a resources from the java environement : // get a resources from the java environement :
static JNIEnv* JavaVirtualMachinePointer = NULL; // the JVM static JNIEnv* JavaVirtualMachinePointer = NULL; // the JVM
static jclass javaClassActivity = 0; // main activity class (android ...) static jclass javaClassEwol = 0; // main activity class (android ...)
static jobject javaObjectActivity = 0; static jclass javaClassEwolCallback = 0;
static jmethodID javaClassActivityEntryPoint = 0; // basic methode to call ... static jobject javaObjectEwolCallback = 0;
static jmethodID javaClassActivityEntryPoint__CPP_keyboardShow = 0; // basic methode to call ...
static jmethodID javaClassActivityEntryPoint__CPP_keyboardHide = 0; // basic methode to call ... static jmethodID javaMethodEwolCallbackEventNotifier = 0; // basic methode to call ...
static jmethodID javaClassActivityEntryPoint__CPP_OrientationChange = 0; static jmethodID javaMethodEwolCallbackKeyboardUpdate = 0; // basic methode to call ...
static jmethodID javaMethodEwolCallbackOrientationUpdate = 0;
// generic classes // generic classes
static jclass javaDefaultClassString = 0; // default string class static jclass javaDefaultClassString = 0; // default string class
@ -50,106 +42,78 @@ static ewol::SpecialKey guiKeyBoardSpecialKeyMode;
// jni doc : /usr/lib/jvm/java-1.6.0-openjdk/include // jni doc : /usr/lib/jvm/java-1.6.0-openjdk/include
void SendJava_KeyboardShow(bool showIt) #define __jni_safe_init_method_id(mid, cls, name, sign) ({ \
{ mid = JavaVirtualMachinePointer->GetMethodID(cls, name, sign); \
if(mid == NULL) { \
EWOL_ERROR("C->java : Can't find the method " << name); \
/* remove access on the virtual machine : */ \
JavaVirtualMachinePointer = NULL; \
return; \
} \
})
static bool java_attach_current_thread(int *rstatus) {
EWOL_DEBUG("C->java : call java"); EWOL_DEBUG("C->java : call java");
if (NULL == g_JavaVM) { if (NULL == g_JavaVM) {
EWOL_DEBUG("C->java : JVM not initialised"); EWOL_DEBUG("C->java : JVM not initialised");
return; return false;
} }
JNIEnv *JavaVirtualMachinePointer_tmp; JNIEnv *JavaVirtualMachinePointer_tmp;
int status = g_JavaVM->GetEnv((void **) &JavaVirtualMachinePointer_tmp, JNI_VERSION_1_6); *rstatus = g_JavaVM->GetEnv((void **) &JavaVirtualMachinePointer_tmp, JNI_VERSION_1_6);
if (status == JNI_EDETACHED) { if (*rstatus == JNI_EDETACHED) {
JavaVMAttachArgs lJavaVMAttachArgs; JavaVMAttachArgs lJavaVMAttachArgs;
lJavaVMAttachArgs.version = JNI_VERSION_1_6; lJavaVMAttachArgs.version = JNI_VERSION_1_6;
lJavaVMAttachArgs.name = "EwolNativeThread"; lJavaVMAttachArgs.name = "EwolNativeThread";
lJavaVMAttachArgs.group = NULL; lJavaVMAttachArgs.group = NULL;
status = g_JavaVM->AttachCurrentThread(&JavaVirtualMachinePointer_tmp, &lJavaVMAttachArgs); int status = g_JavaVM->AttachCurrentThread(&JavaVirtualMachinePointer_tmp, &lJavaVMAttachArgs);
if (JavaVirtualMachinePointer->ExceptionOccurred()) {
EWOL_DEBUG("C->java : EXEPTION ...");
JavaVirtualMachinePointer->ExceptionDescribe();
JavaVirtualMachinePointer->ExceptionClear();
}
if (status != JNI_OK) { if (status != JNI_OK) {
EWOL_DEBUG("C->java : AttachCurrentThread failed : " << status); EWOL_DEBUG("C->java : AttachCurrentThread failed : " << status);
return; return false;
}
if (JavaVirtualMachinePointer->ExceptionOccurred()) {
EWOL_DEBUG("C->java : EXEPTION ...");
JavaVirtualMachinePointer->ExceptionDescribe();
JavaVirtualMachinePointer->ExceptionClear();
} }
} }
if (JavaVirtualMachinePointer->ExceptionOccurred()) { return true;
EWOL_DEBUG("C->java : EXEPTION ..."); }
JavaVirtualMachinePointer->ExceptionDescribe(); static void java_detach_current_thread(int status) {
JavaVirtualMachinePointer->ExceptionClear(); if(status == JNI_EDETACHED) g_JavaVM->DetachCurrentThread();
} }
if (NULL == JavaVirtualMachinePointer) {
EWOL_DEBUG("C->java : JVM not initialised");
return;
} void SendJavaKeyboardUpdate(bool showIt)
{
int status;
if(!java_attach_current_thread(&status)) return;
//Call java ... //Call java ...
if (true == showIt) { JavaVirtualMachinePointer->CallVoidMethod(javaObjectEwolCallback, javaMethodEwolCallbackKeyboardUpdate, showIt ? JNI_TRUE : JNI_FALSE);
JavaVirtualMachinePointer->CallVoidMethod(javaObjectActivity, javaClassActivityEntryPoint__CPP_keyboardShow);
} else {
JavaVirtualMachinePointer->CallVoidMethod(javaObjectActivity, javaClassActivityEntryPoint__CPP_keyboardHide);
}
// manage execption : // manage execption :
if (JavaVirtualMachinePointer->ExceptionOccurred()) { if (JavaVirtualMachinePointer->ExceptionOccurred()) {
EWOL_DEBUG("C->java : EXEPTION ..."); EWOL_DEBUG("C->java : EXEPTION ...");
JavaVirtualMachinePointer->ExceptionDescribe(); JavaVirtualMachinePointer->ExceptionDescribe();
JavaVirtualMachinePointer->ExceptionClear(); JavaVirtualMachinePointer->ExceptionClear();
} }
if (status == JNI_EDETACHED) { java_detach_current_thread(status);
// Finished with the JVM.
g_JavaVM->DetachCurrentThread();
}
} }
// mode 0 : auto; 1 landscape, 2 portrait // mode 0 : auto; 1 landscape, 2 portrait
void SendJava_OrientationChange(int32_t mode) void SendJavaOrientationUpdate(int32_t mode)
{ {
#ifndef __ANDROID_PERMISSION__SET_ORIENTATION__ #ifndef __ANDROID_PERMISSION__SET_ORIENTATION__
EWOL_ERROR("C->java : call set orientation without Allow application to do it ... Break..."); EWOL_ERROR("C->java : call set orientation without Allow application to do it ... Break...");
return; return;
#else #else
EWOL_DEBUG("C->java : call java"); int status;
if (NULL == g_JavaVM) { if(!java_attach_current_thread(&status)) return;
EWOL_DEBUG("C->java : JVM not initialised");
return;
}
JNIEnv *JavaVirtualMachinePointer_tmp;
int status = g_JavaVM->GetEnv((void **) &JavaVirtualMachinePointer_tmp, JNI_VERSION_1_6);
if (status == JNI_EDETACHED) {
JavaVMAttachArgs lJavaVMAttachArgs;
lJavaVMAttachArgs.version = JNI_VERSION_1_6;
lJavaVMAttachArgs.name = "EwolNativeThread";
lJavaVMAttachArgs.group = NULL;
status = g_JavaVM->AttachCurrentThread(&JavaVirtualMachinePointer_tmp, &lJavaVMAttachArgs);
if (status != JNI_OK) {
EWOL_DEBUG("C->java : AttachCurrentThread failed : " << status);
return;
}
if (JavaVirtualMachinePointer->ExceptionOccurred()) {
EWOL_DEBUG("C->java : EXEPTION ...");
JavaVirtualMachinePointer->ExceptionDescribe();
JavaVirtualMachinePointer->ExceptionClear();
}
}
if (JavaVirtualMachinePointer->ExceptionOccurred()) {
EWOL_DEBUG("C->java : EXEPTION ...");
JavaVirtualMachinePointer->ExceptionDescribe();
JavaVirtualMachinePointer->ExceptionClear();
}
if (NULL == JavaVirtualMachinePointer) {
EWOL_DEBUG("C->java : JVM not initialised");
return;
}
jint param = mode; jint param = mode;
//Call java ... //Call java ...
JavaVirtualMachinePointer->CallVoidMethod(javaObjectActivity, javaClassActivityEntryPoint__CPP_OrientationChange, param); JavaVirtualMachinePointer->CallVoidMethod(javaObjectActivity, javaMethodEwolCallbackOrientationUpdate, param);
// manage execption : // manage execption :
if (JavaVirtualMachinePointer->ExceptionOccurred()) { if (JavaVirtualMachinePointer->ExceptionOccurred()) {
@ -157,11 +121,7 @@ void SendJava_OrientationChange(int32_t mode)
JavaVirtualMachinePointer->ExceptionDescribe(); JavaVirtualMachinePointer->ExceptionDescribe();
JavaVirtualMachinePointer->ExceptionClear(); JavaVirtualMachinePointer->ExceptionClear();
} }
java_detach_current_thread(status);
if (status == JNI_EDETACHED) {
// Finished with the JVM.
g_JavaVM->DetachCurrentThread();
}
#endif #endif
} }
@ -212,7 +172,7 @@ void SendSystemMessage(const char * dataString)
} }
EWOL_DEBUG("C->java : 555"); EWOL_DEBUG("C->java : 555");
//Call java ... //Call java ...
JavaVirtualMachinePointer->CallStaticVoidMethod(javaClassActivity, javaClassActivityEntryPoint, args); JavaVirtualMachinePointer->CallVoidMethod(javaObjectEwolCallback, javaMethodEwolCallbackEventNotifier, args);
EWOL_DEBUG("C->java : 666"); EWOL_DEBUG("C->java : 666");
// manage execption : // manage execption :
@ -249,7 +209,7 @@ extern "C"
/* Call to initialize the graphics state */ /* Call to initialize the graphics state */
void Java_org_ewol_ActivityParamSetArchiveDir( JNIEnv* env, jobject thiz, jint mode, jstring myString) void Java_org_ewol_Ewol_paramSetArchiveDir(JNIEnv* env, jclass cls, jint mode, jstring myString)
{ {
// direct setting of the date in the string system ... // direct setting of the date in the string system ...
jboolean isCopy; jboolean isCopy;
@ -262,7 +222,7 @@ extern "C"
} }
} }
void Java_org_ewol_ActivitySetJavaVortualMachineStart( JNIEnv* env, jclass classBase, jobject obj) void Java_org_ewol_Ewol_setJavaVirtualMachineStart(JNIEnv* env, jclass classBase, jobject objCallback)
{ {
EWOL_DEBUG("*******************************************"); EWOL_DEBUG("*******************************************");
EWOL_DEBUG("** Set JVM Pointer **"); EWOL_DEBUG("** Set JVM Pointer **");
@ -270,46 +230,41 @@ extern "C"
JavaVirtualMachinePointer = env; JavaVirtualMachinePointer = env;
// get default needed all time elements : // get default needed all time elements :
if (NULL != JavaVirtualMachinePointer) { if (NULL != JavaVirtualMachinePointer) {
EWOL_DEBUG("C->java : try load org/edouarddupin/edn/edn class"); EWOL_DEBUG("C->java : try load org/ewol/Ewol class");
javaClassActivity = JavaVirtualMachinePointer->FindClass("org/edouarddupin/edn/edn" ); javaClassEwol = JavaVirtualMachinePointer->FindClass("org/ewol/Ewol" );
if (javaClassActivity == 0) { if (javaClassEwol == 0) {
EWOL_ERROR("C->java : Can't find org/edouarddupin/edn/edn class"); EWOL_ERROR("C->java : Can't find org/ewol/Ewol class");
// remove access on the virtual machine : // remove access on the virtual machine :
JavaVirtualMachinePointer = NULL; JavaVirtualMachinePointer = NULL;
return; return;
} }
// get the activity object : /* The object field extends Activity and implement EwolCallback */
javaClassActivityEntryPoint = JavaVirtualMachinePointer->GetStaticMethodID(javaClassActivity, "eventFromCPP", "([Ljava/lang/String;)V" ); javaClassEwolCallback = JavaVirtualMachinePointer->GetObjectClass(objCallback);
if (javaClassActivityEntryPoint == 0) { if(javaClassEwolCallback == NULL) {
EWOL_ERROR("C->java : Can't find org/edouarddupin/edn/edn.eventFromCPP" ); EWOL_ERROR("C->java : Can't find org/ewol/EwolCallback class");
// remove access on the virtual machine :
JavaVirtualMachinePointer = NULL;
return;
}
javaClassActivityEntryPoint__CPP_keyboardShow = JavaVirtualMachinePointer->GetMethodID(javaClassActivity, "CPP_keyboardShow", "()V" );
if (javaClassActivityEntryPoint__CPP_keyboardShow == 0) {
EWOL_ERROR("C->java : Can't find org/edouarddupin/edn/edn.CPP_keyboardShow" );
// remove access on the virtual machine :
JavaVirtualMachinePointer = NULL;
return;
}
javaClassActivityEntryPoint__CPP_keyboardHide = JavaVirtualMachinePointer->GetMethodID(javaClassActivity, "CPP_keyboardHide", "()V" );
if (javaClassActivityEntryPoint__CPP_keyboardHide == 0) {
EWOL_ERROR("C->java : Can't find org/edouarddupin/edn/edn.CPP_keyboardHide" );
// remove access on the virtual machine :
JavaVirtualMachinePointer = NULL;
return;
}
javaClassActivityEntryPoint__CPP_OrientationChange = JavaVirtualMachinePointer->GetMethodID(javaClassActivity, "CPP_OrientationChange", "(I)V" );
if (javaClassActivityEntryPoint__CPP_OrientationChange == 0) {
EWOL_ERROR("C->java : Can't find org/edouarddupin/edn/edn.CPP_OrientationChange" );
// remove access on the virtual machine : // remove access on the virtual machine :
JavaVirtualMachinePointer = NULL; JavaVirtualMachinePointer = NULL;
return; return;
} }
__jni_safe_init_method_id(
javaMethodEwolCallbackEventNotifier,
javaClassEwolCallback,
"eventNotifier", "([Ljava/lang/String;)V");
__jni_safe_init_method_id(
javaMethodEwolCallbackKeyboardUpdate,
javaClassEwolCallback,
"keyboardUpdate", "(Z)V");
__jni_safe_init_method_id(
javaMethodEwolCallbackOrientationUpdate,
javaClassEwolCallback,
"orientationUpdate", "(I)V");
//javaObjectActivity = JavaVirtualMachinePointer->NewGlobalRef(obj); //javaObjectActivity = JavaVirtualMachinePointer->NewGlobalRef(obj);
javaObjectActivity = obj; /* realy unsafe... */
javaObjectEwolCallback = objCallback;
javaDefaultClassString = JavaVirtualMachinePointer->FindClass("java/lang/String" ); javaDefaultClassString = JavaVirtualMachinePointer->FindClass("java/lang/String" );
if (javaDefaultClassString == 0) { if (javaDefaultClassString == 0) {
@ -320,14 +275,13 @@ extern "C"
} }
} }
} }
void Java_org_ewol_ActivitySetJavaVortualMachineStop( JNIEnv* env ) void Java_org_ewol_Ewol_setJavaVirtualMachineStop(JNIEnv* env, jclass cls) {
{
EWOL_DEBUG("*******************************************"); EWOL_DEBUG("*******************************************");
EWOL_DEBUG("** Remove JVM Pointer **"); EWOL_DEBUG("** Remove JVM Pointer **");
EWOL_DEBUG("*******************************************"); EWOL_DEBUG("*******************************************");
JavaVirtualMachinePointer = NULL; JavaVirtualMachinePointer = NULL;
} }
void Java_org_ewol_TouchEvent( JNIEnv* env ) void Java_org_ewol_Ewol_touchEvent( JNIEnv* env, jobject thiz )
{ {
EWOL_DEBUG(" ==> Touch Event"); EWOL_DEBUG(" ==> Touch Event");
if (env->ExceptionOccurred()) { if (env->ExceptionOccurred()) {
@ -336,33 +290,34 @@ extern "C"
} }
} }
void Java_org_ewol_ActivityOnCreate( JNIEnv* env ) void Java_org_ewol_Ewol_onCreate( JNIEnv* env, jobject thiz )
{ {
EWOL_DEBUG("*******************************************"); EWOL_DEBUG("*******************************************");
EWOL_DEBUG("** Activity On Create **"); EWOL_DEBUG("** Activity On Create **");
EWOL_DEBUG("*******************************************"); EWOL_DEBUG("*******************************************");
eSystem::Init(); eSystem::Init();
} }
void Java_org_ewol_ActivityOnStart( JNIEnv* env )
void Java_org_ewol_Ewol_onStart(JNIEnv* env, jobject thiz)
{ {
EWOL_DEBUG("*******************************************"); EWOL_DEBUG("*******************************************");
EWOL_DEBUG("** Activity On Start **"); EWOL_DEBUG("** Activity On Start **");
EWOL_DEBUG("*******************************************"); EWOL_DEBUG("*******************************************");
//SendSystemMessage(" testmessages ... "); //SendSystemMessage(" testmessages ... ");
} }
void Java_org_ewol_ActivityOnReStart( JNIEnv* env ) void Java_org_ewol_Ewol_onReStart(JNIEnv* env, jobject thiz)
{ {
EWOL_DEBUG("*******************************************"); EWOL_DEBUG("*******************************************");
EWOL_DEBUG("** Activity On Re-Start **"); EWOL_DEBUG("** Activity On Re-Start **");
EWOL_DEBUG("*******************************************"); EWOL_DEBUG("*******************************************");
} }
void Java_org_ewol_ActivityOnResume( JNIEnv* env ) void Java_org_ewol_Ewol_onResume(JNIEnv* env, jobject thiz)
{ {
EWOL_DEBUG("*******************************************"); EWOL_DEBUG("*******************************************");
EWOL_DEBUG("** Activity On Resume **"); EWOL_DEBUG("** Activity On Resume **");
EWOL_DEBUG("*******************************************"); EWOL_DEBUG("*******************************************");
} }
void Java_org_ewol_ActivityOnPause( JNIEnv* env ) void Java_org_ewol_Ewol_onPause(JNIEnv* env, jobject thiz)
{ {
EWOL_DEBUG("*******************************************"); EWOL_DEBUG("*******************************************");
EWOL_DEBUG("** Activity On Pause **"); EWOL_DEBUG("** Activity On Pause **");
@ -370,13 +325,13 @@ extern "C"
// All the openGl has been destroyed ... // All the openGl has been destroyed ...
eSystem::OpenGlContextDestroy(); eSystem::OpenGlContextDestroy();
} }
void Java_org_ewol_ActivityOnStop( JNIEnv* env ) void Java_org_ewol_Ewol_onStop(JNIEnv* env, jobject thiz)
{ {
EWOL_DEBUG("*******************************************"); EWOL_DEBUG("*******************************************");
EWOL_DEBUG("** Activity On Stop **"); EWOL_DEBUG("** Activity On Stop **");
EWOL_DEBUG("*******************************************"); EWOL_DEBUG("*******************************************");
} }
void Java_org_ewol_ActivityOnDestroy( JNIEnv* env ) void Java_org_ewol_Ewol_onDestroy(JNIEnv* env, jobject thiz)
{ {
EWOL_DEBUG("*******************************************"); EWOL_DEBUG("*******************************************");
EWOL_DEBUG("** Activity On Destroy **"); EWOL_DEBUG("** Activity On Destroy **");
@ -389,78 +344,70 @@ extern "C"
/* ********************************************************************************************** /* **********************************************************************************************
* ** IO section : * ** IO section :
* ********************************************************************************************** */ * ********************************************************************************************** */
void Java_org_ewol_IOInputEventMotion( JNIEnv* env, jobject thiz, jint pointerID, jfloat x, jfloat y ) void Java_org_ewol_Ewol_inputEventMotion( JNIEnv* env, jobject thiz, jint pointerID, jfloat x, jfloat y )
{ {
eSystem::SetInputMotion(pointerID+1, x, m_currentHeight-y); eSystem::SetInputMotion(pointerID+1, x, m_currentHeight-y);
} }
void Java_org_ewol_IOInputEventState( JNIEnv* env, jobject thiz, jint pointerID, jboolean isUp, jfloat x, jfloat y ) void Java_org_ewol_Ewol_inputEventState( JNIEnv* env, jobject thiz, jint pointerID, jboolean isUp, jfloat x, jfloat y )
{ {
eSystem::SetInputState(pointerID+1, isUp, x, m_currentHeight-y); eSystem::SetInputState(pointerID+1, isUp, x, m_currentHeight-y);
} }
void Java_org_ewol_IOMouseEventMotion( JNIEnv* env, jobject thiz, jint pointerID, jfloat x, jfloat y ) void Java_org_ewol_Ewol_mouseEventMotion( JNIEnv* env, jobject thiz, jint pointerID, jfloat x, jfloat y )
{ {
eSystem::SetMouseMotion(pointerID+1, x, m_currentHeight-y); eSystem::SetMouseMotion(pointerID+1, x, m_currentHeight-y);
} }
void Java_org_ewol_IOMouseEventState( JNIEnv* env, jobject thiz, jint pointerID, jboolean isUp, jfloat x, jfloat y ) void Java_org_ewol_Ewol_mouseEventState( JNIEnv* env, jobject thiz, jint pointerID, jboolean isUp, jfloat x, jfloat y )
{ {
eSystem::SetMouseState(pointerID+1, isUp, x, m_currentHeight-y); eSystem::SetMouseState(pointerID+1, isUp, x, m_currentHeight-y);
} }
void Java_org_ewol_IOUnknowEvent( JNIEnv* env, jobject thiz, jint pointerID) void Java_org_ewol_Ewol_unknowEvent( JNIEnv* env, jobject thiz, jint pointerID)
{ {
EWOL_DEBUG("Unknown IO event : " << pointerID << " ???"); EWOL_DEBUG("Unknown IO event : " << pointerID << " ???");
} }
void Java_org_ewol_IOKeyboardEventMove( JNIEnv* env, jobject thiz, jint type, jboolean isdown) void Java_org_ewol_Ewol_keyboardEventMove( JNIEnv* env, jobject thiz, jint type, jboolean isdown)
{ {
EWOL_DEBUG("IO keyboard Move event : \"" << type << "\" is down=" << isdown); EWOL_DEBUG("IO keyboard Move event : \"" << type << "\" is down=" << isdown);
} }
void Java_org_ewol_IOKeyboardEventKey( JNIEnv* env, jobject thiz, jint uniChar, jboolean isdown) void Java_org_ewol_Ewol_keyboardEventKey( JNIEnv* env, jobject thiz, jint uniChar, jboolean isdown)
{ {
EWOL_DEBUG("IO keyboard Key event : \"" << uniChar << "\" is down=" << isdown); EWOL_DEBUG("IO keyboard Key event : \"" << uniChar << "\" is down=" << isdown);
eSystem::SetKeyboard(guiKeyBoardSpecialKeyMode, uniChar, isdown); eSystem::SetKeyboard(guiKeyBoardSpecialKeyMode, uniChar, isdown);
} }
void Java_org_ewol_DisplayPropertyMetrics( JNIEnv* env, jobject thiz, jfloat ratioX, jfloat ratioY) void Java_org_ewol_Ewol_displayPropertyMetrics( JNIEnv* env, jobject thiz, jfloat ratioX, jfloat ratioY)
{ {
// set the internal system ratio properties ... // set the internal system ratio properties ...
ewol::dimension::SetPixelRatio(vec2(ratioX,ratioY), ewol::Dimension::Inch); ewol::dimension::SetPixelRatio(vec2(ratioX,ratioY), ewol::Dimension::Inch);
} }
enum {
SYSTEM_KEY__VOLUME_UP = 1,
SYSTEM_KEY__VOLUME_DOWN,
SYSTEM_KEY__MENU,
SYSTEM_KEY__CAMERA,
SYSTEM_KEY__HOME,
SYSTEM_KEY__POWER,
};
// TODO : Set a return true or false if we want to grep this event ... // TODO : Set a return true or false if we want to grep this event ...
void Java_org_ewol_IOKeyboardEventKeySystem( JNIEnv* env, jobject thiz, jint keyVal, jboolean isdown) void Java_org_ewol_Ewol_keyboardEventKeySystem( JNIEnv* env, jobject thiz, jint keyVal, jboolean isdown)
{ {
switch (keyVal) switch (keyVal)
{ {
case SYSTEM_KEY__VOLUME_UP: case org_ewol_EwolConstants_EWOL_SYSTEM_KEY_VOLUME_UP:
EWOL_DEBUG("IO keyboard Key System \"VOLUME_UP\" is down=" << keyVal); EWOL_DEBUG("IO keyboard Key System \"VOLUME_UP\" is down=" << isdown);
break; break;
case SYSTEM_KEY__VOLUME_DOWN: case org_ewol_EwolConstants_EWOL_SYSTEM_KEY_VOLUME_DOWN:
EWOL_DEBUG("IO keyboard Key System \"VOLUME_DOWN\" is down=" << keyVal); EWOL_DEBUG("IO keyboard Key System \"VOLUME_DOWN\" is down=" << isdown);
break; break;
case SYSTEM_KEY__MENU: case org_ewol_EwolConstants_EWOL_SYSTEM_KEY_MENU:
EWOL_DEBUG("IO keyboard Key System \"MENU\" is down=" << keyVal); EWOL_DEBUG("IO keyboard Key System \"MENU\" is down=" << isdown);
break; break;
case SYSTEM_KEY__CAMERA: case org_ewol_EwolConstants_EWOL_SYSTEM_KEY_CAMERA:
EWOL_DEBUG("IO keyboard Key System \"CAMERA\" is down=" << keyVal); EWOL_DEBUG("IO keyboard Key System \"CAMERA\" is down=" << isdown);
break; break;
case SYSTEM_KEY__HOME: case org_ewol_EwolConstants_EWOL_SYSTEM_KEY_HOME:
EWOL_DEBUG("IO keyboard Key System \"HOME\" is down=" << keyVal); EWOL_DEBUG("IO keyboard Key System \"HOME\" is down=" << isdown);
break; break;
case SYSTEM_KEY__POWER: case org_ewol_EwolConstants_EWOL_SYSTEM_KEY_POWER:
EWOL_DEBUG("IO keyboard Key System \"POWER\" is down=" << keyVal); EWOL_DEBUG("IO keyboard Key System \"POWER\" is down=" << isdown);
break; break;
default: default:
EWOL_DEBUG("IO keyboard Key System event : \"" << keyVal << "\" is down=" << isdown); EWOL_DEBUG("IO keyboard Key System event : \"" << keyVal << "\" is down=" << isdown);
@ -472,23 +419,23 @@ extern "C"
/* ********************************************************************************************** /* **********************************************************************************************
* ** Renderer section : * ** Renderer section :
* ********************************************************************************************** */ * ********************************************************************************************** */
void Java_org_ewol_RenderInit( JNIEnv* env ) void Java_org_ewol_Ewol_renderInit(JNIEnv* env, jobject thiz)
{ {
} }
void Java_org_ewol_RenderResize( JNIEnv* env, jobject thiz, jint w, jint h ) void Java_org_ewol_Ewol_renderResize( JNIEnv* env, jobject thiz, jint w, jint h )
{ {
m_currentHeight = h; m_currentHeight = h;
eSystem::Resize(w, h); eSystem::Resize(w, h);
} }
void Java_org_ewol_RenderDraw( JNIEnv* env ) void Java_org_ewol_Ewol_renderDraw(JNIEnv* env, jobject thiz)
{ {
eSystem::Draw(true); eSystem::Draw(true);
} }
void Java_org_ewol_IOAudioPlayback(JNIEnv* env, void* reserved, jshortArray location, jint frameRate, jint nbChannels) void Java_org_ewol_Ewol_audioPlayback(JNIEnv* env, void* reserved, jshortArray location, jint frameRate, jint nbChannels)
{ {
// Get the short* pointer from the Java array // Get the short* pointer from the Java array
jboolean isCopy; jboolean isCopy;
@ -514,6 +461,7 @@ extern "C"
int guiInterface::main(int argc, const char *argv[]) int guiInterface::main(int argc, const char *argv[])
{ {
// unneeded fuction, all is controlled by android java ... // unneeded fuction, all is controlled by android java ...
return 0;
} }
int64_t guiInterface::GetTime(void) int64_t guiInterface::GetTime(void)
@ -591,18 +539,18 @@ void guiInterface::Stop(void)
// java system to send message : // java system to send message :
void SendSystemMessage(const char * dataString); void SendSystemMessage(const char * dataString);
void SendJava_KeyboardShow(bool showIt); void SendJavaKeyboardUpdate(bool showIt);
void guiInterface::KeyboardShow(void) void guiInterface::KeyboardShow(void)
{ {
// send a message at the java : // send a message at the java :
SendJava_KeyboardShow(true); SendJavaKeyboardUpdate(true);
} }
void guiInterface::KeyboardHide(void) void guiInterface::KeyboardHide(void)
{ {
// send a message at the java : // send a message at the java :
SendJava_KeyboardShow(false); SendJavaKeyboardUpdate(false);
} }
void guiInterface::ChangeSize(ivec2 size) void guiInterface::ChangeSize(ivec2 size)
@ -622,7 +570,7 @@ void guiInterface::GetAbsPos(ivec2& size)
void guiInterface::ForceOrientation(ewol::orientation_te orientation) void guiInterface::ForceOrientation(ewol::orientation_te orientation)
{ {
SendJava_OrientationChange((int32_t)orientation); SendJavaOrientationUpdate((int32_t)orientation);
} }
void guiInterface::GrabPointerEvents(bool isGrabbed, vec2 forcedPosition) void guiInterface::GrabPointerEvents(bool isGrabbed, vec2 forcedPosition)
@ -641,4 +589,3 @@ void guiInterface::SetIcon(etk::UString inputFile)
} }