[DEV] fixes the compatibility with the java code... not tested...
This commit is contained in:
parent
59483ab23b
commit
0df2c89ed0
@ -1,16 +1,5 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @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
|
||||
* @author Edouard DUPIN, Kevin BILLONNEAU
|
||||
*
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
*
|
||||
@ -27,15 +16,18 @@
|
||||
#include <ewol/renderer/audio/audio.h>
|
||||
#include <ewol/renderer/os/gui.h>
|
||||
#include <ewol/Dimension.h>
|
||||
/* include auto generated file */
|
||||
#include <ewol/renderer/os/org_ewol_EwolConstants.h>
|
||||
|
||||
// get a resources from the java environement :
|
||||
static JNIEnv* JavaVirtualMachinePointer = NULL; // the JVM
|
||||
static jclass javaClassActivity = 0; // main activity class (android ...)
|
||||
static jobject javaObjectActivity = 0;
|
||||
static jmethodID javaClassActivityEntryPoint = 0; // basic methode to call ...
|
||||
static jmethodID javaClassActivityEntryPoint__CPP_keyboardShow = 0; // basic methode to call ...
|
||||
static jmethodID javaClassActivityEntryPoint__CPP_keyboardHide = 0; // basic methode to call ...
|
||||
static jmethodID javaClassActivityEntryPoint__CPP_OrientationChange = 0;
|
||||
static jclass javaClassEwol = 0; // main activity class (android ...)
|
||||
static jclass javaClassEwolCallback = 0;
|
||||
static jobject javaObjectEwolCallback = 0;
|
||||
|
||||
static jmethodID javaMethodEwolCallbackEventNotifier = 0; // basic methode to call ...
|
||||
static jmethodID javaMethodEwolCallbackKeyboardUpdate = 0; // basic methode to call ...
|
||||
static jmethodID javaMethodEwolCallbackOrientationUpdate = 0;
|
||||
// generic classes
|
||||
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
|
||||
|
||||
|
||||
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");
|
||||
if (NULL == g_JavaVM) {
|
||||
EWOL_DEBUG("C->java : JVM not initialised");
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
JNIEnv *JavaVirtualMachinePointer_tmp;
|
||||
int status = g_JavaVM->GetEnv((void **) &JavaVirtualMachinePointer_tmp, JNI_VERSION_1_6);
|
||||
if (status == JNI_EDETACHED) {
|
||||
*rstatus = g_JavaVM->GetEnv((void **) &JavaVirtualMachinePointer_tmp, JNI_VERSION_1_6);
|
||||
if (*rstatus == JNI_EDETACHED) {
|
||||
JavaVMAttachArgs lJavaVMAttachArgs;
|
||||
lJavaVMAttachArgs.version = JNI_VERSION_1_6;
|
||||
lJavaVMAttachArgs.name = "EwolNativeThread";
|
||||
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) {
|
||||
EWOL_DEBUG("C->java : AttachCurrentThread failed : " << status);
|
||||
return;
|
||||
}
|
||||
if (JavaVirtualMachinePointer->ExceptionOccurred()) {
|
||||
EWOL_DEBUG("C->java : EXEPTION ...");
|
||||
JavaVirtualMachinePointer->ExceptionDescribe();
|
||||
JavaVirtualMachinePointer->ExceptionClear();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (JavaVirtualMachinePointer->ExceptionOccurred()) {
|
||||
EWOL_DEBUG("C->java : EXEPTION ...");
|
||||
JavaVirtualMachinePointer->ExceptionDescribe();
|
||||
JavaVirtualMachinePointer->ExceptionClear();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
static void java_detach_current_thread(int status) {
|
||||
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 ...
|
||||
if (true == showIt) {
|
||||
JavaVirtualMachinePointer->CallVoidMethod(javaObjectActivity, javaClassActivityEntryPoint__CPP_keyboardShow);
|
||||
} else {
|
||||
JavaVirtualMachinePointer->CallVoidMethod(javaObjectActivity, javaClassActivityEntryPoint__CPP_keyboardHide);
|
||||
}
|
||||
|
||||
JavaVirtualMachinePointer->CallVoidMethod(javaObjectEwolCallback, javaMethodEwolCallbackKeyboardUpdate, showIt ? JNI_TRUE : JNI_FALSE);
|
||||
// manage execption :
|
||||
if (JavaVirtualMachinePointer->ExceptionOccurred()) {
|
||||
EWOL_DEBUG("C->java : EXEPTION ...");
|
||||
JavaVirtualMachinePointer->ExceptionDescribe();
|
||||
JavaVirtualMachinePointer->ExceptionClear();
|
||||
}
|
||||
if (status == JNI_EDETACHED) {
|
||||
// Finished with the JVM.
|
||||
g_JavaVM->DetachCurrentThread();
|
||||
}
|
||||
java_detach_current_thread(status);
|
||||
}
|
||||
|
||||
// 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...");
|
||||
return;
|
||||
#else
|
||||
EWOL_DEBUG("C->java : call java");
|
||||
if (NULL == g_JavaVM) {
|
||||
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;
|
||||
}
|
||||
|
||||
#else
|
||||
int status;
|
||||
if(!java_attach_current_thread(&status)) return;
|
||||
jint param = mode;
|
||||
|
||||
//Call java ...
|
||||
JavaVirtualMachinePointer->CallVoidMethod(javaObjectActivity, javaClassActivityEntryPoint__CPP_OrientationChange, param);
|
||||
JavaVirtualMachinePointer->CallVoidMethod(javaObjectActivity, javaMethodEwolCallbackOrientationUpdate, param);
|
||||
|
||||
// manage execption :
|
||||
if (JavaVirtualMachinePointer->ExceptionOccurred()) {
|
||||
@ -157,12 +121,8 @@ void SendJava_OrientationChange(int32_t mode)
|
||||
JavaVirtualMachinePointer->ExceptionDescribe();
|
||||
JavaVirtualMachinePointer->ExceptionClear();
|
||||
}
|
||||
|
||||
if (status == JNI_EDETACHED) {
|
||||
// Finished with the JVM.
|
||||
g_JavaVM->DetachCurrentThread();
|
||||
}
|
||||
#endif
|
||||
java_detach_current_thread(status);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -212,7 +172,7 @@ void SendSystemMessage(const char * dataString)
|
||||
}
|
||||
EWOL_DEBUG("C->java : 555");
|
||||
//Call java ...
|
||||
JavaVirtualMachinePointer->CallStaticVoidMethod(javaClassActivity, javaClassActivityEntryPoint, args);
|
||||
JavaVirtualMachinePointer->CallVoidMethod(javaObjectEwolCallback, javaMethodEwolCallbackEventNotifier, args);
|
||||
|
||||
EWOL_DEBUG("C->java : 666");
|
||||
// manage execption :
|
||||
@ -227,7 +187,7 @@ void SendSystemMessage(const char * dataString)
|
||||
}
|
||||
|
||||
namespace guiAbstraction {
|
||||
void SendKeyboardEvent(bool isDown, uniChar_t keyInput);
|
||||
void SendKeyboardEvent(bool isDown, uniChar_t keyInput);
|
||||
};
|
||||
|
||||
extern "C"
|
||||
@ -249,7 +209,7 @@ extern "C"
|
||||
|
||||
|
||||
/* 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 ...
|
||||
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("** Set JVM Pointer **");
|
||||
@ -270,46 +230,41 @@ extern "C"
|
||||
JavaVirtualMachinePointer = env;
|
||||
// get default needed all time elements :
|
||||
if (NULL != JavaVirtualMachinePointer) {
|
||||
EWOL_DEBUG("C->java : try load org/edouarddupin/edn/edn class");
|
||||
javaClassActivity = JavaVirtualMachinePointer->FindClass("org/edouarddupin/edn/edn" );
|
||||
if (javaClassActivity == 0) {
|
||||
EWOL_ERROR("C->java : Can't find org/edouarddupin/edn/edn class");
|
||||
EWOL_DEBUG("C->java : try load org/ewol/Ewol class");
|
||||
javaClassEwol = JavaVirtualMachinePointer->FindClass("org/ewol/Ewol" );
|
||||
if (javaClassEwol == 0) {
|
||||
EWOL_ERROR("C->java : Can't find org/ewol/Ewol class");
|
||||
// remove access on the virtual machine :
|
||||
JavaVirtualMachinePointer = NULL;
|
||||
return;
|
||||
}
|
||||
// get the activity object :
|
||||
javaClassActivityEntryPoint = JavaVirtualMachinePointer->GetStaticMethodID(javaClassActivity, "eventFromCPP", "([Ljava/lang/String;)V" );
|
||||
if (javaClassActivityEntryPoint == 0) {
|
||||
EWOL_ERROR("C->java : Can't find org/edouarddupin/edn/edn.eventFromCPP" );
|
||||
// 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" );
|
||||
/* The object field extends Activity and implement EwolCallback */
|
||||
javaClassEwolCallback = JavaVirtualMachinePointer->GetObjectClass(objCallback);
|
||||
if(javaClassEwolCallback == NULL) {
|
||||
EWOL_ERROR("C->java : Can't find org/ewol/EwolCallback class");
|
||||
// remove access on the virtual machine :
|
||||
JavaVirtualMachinePointer = NULL;
|
||||
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 = obj;
|
||||
/* realy unsafe... */
|
||||
javaObjectEwolCallback = objCallback;
|
||||
|
||||
javaDefaultClassString = JavaVirtualMachinePointer->FindClass("java/lang/String" );
|
||||
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("** Remove JVM Pointer **");
|
||||
EWOL_DEBUG("*******************************************");
|
||||
JavaVirtualMachinePointer = NULL;
|
||||
}
|
||||
void Java_org_ewol_TouchEvent( JNIEnv* env )
|
||||
void Java_org_ewol_Ewol_touchEvent( JNIEnv* env, jobject thiz )
|
||||
{
|
||||
EWOL_DEBUG(" ==> Touch Event");
|
||||
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("** Activity On Create **");
|
||||
EWOL_DEBUG("*******************************************");
|
||||
eSystem::Init();
|
||||
}
|
||||
void Java_org_ewol_ActivityOnStart( JNIEnv* env )
|
||||
|
||||
void Java_org_ewol_Ewol_onStart(JNIEnv* env, jobject thiz)
|
||||
{
|
||||
EWOL_DEBUG("*******************************************");
|
||||
EWOL_DEBUG("** Activity On Start **");
|
||||
EWOL_DEBUG("*******************************************");
|
||||
//SendSystemMessage(" testmessages ... ");
|
||||
}
|
||||
void Java_org_ewol_ActivityOnReStart( JNIEnv* env )
|
||||
void Java_org_ewol_Ewol_onReStart(JNIEnv* env, jobject thiz)
|
||||
{
|
||||
EWOL_DEBUG("*******************************************");
|
||||
EWOL_DEBUG("** Activity On Re-Start **");
|
||||
EWOL_DEBUG("*******************************************");
|
||||
}
|
||||
void Java_org_ewol_ActivityOnResume( JNIEnv* env )
|
||||
void Java_org_ewol_Ewol_onResume(JNIEnv* env, jobject thiz)
|
||||
{
|
||||
EWOL_DEBUG("*******************************************");
|
||||
EWOL_DEBUG("** Activity On Resume **");
|
||||
EWOL_DEBUG("*******************************************");
|
||||
}
|
||||
void Java_org_ewol_ActivityOnPause( JNIEnv* env )
|
||||
void Java_org_ewol_Ewol_onPause(JNIEnv* env, jobject thiz)
|
||||
{
|
||||
EWOL_DEBUG("*******************************************");
|
||||
EWOL_DEBUG("** Activity On Pause **");
|
||||
@ -370,13 +325,13 @@ extern "C"
|
||||
// All the openGl has been destroyed ...
|
||||
eSystem::OpenGlContextDestroy();
|
||||
}
|
||||
void Java_org_ewol_ActivityOnStop( JNIEnv* env )
|
||||
void Java_org_ewol_Ewol_onStop(JNIEnv* env, jobject thiz)
|
||||
{
|
||||
EWOL_DEBUG("*******************************************");
|
||||
EWOL_DEBUG("** Activity On Stop **");
|
||||
EWOL_DEBUG("*******************************************");
|
||||
}
|
||||
void Java_org_ewol_ActivityOnDestroy( JNIEnv* env )
|
||||
void Java_org_ewol_Ewol_onDestroy(JNIEnv* env, jobject thiz)
|
||||
{
|
||||
EWOL_DEBUG("*******************************************");
|
||||
EWOL_DEBUG("** Activity On Destroy **");
|
||||
@ -389,78 +344,70 @@ extern "C"
|
||||
/* **********************************************************************************************
|
||||
* ** 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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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 << " ???");
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
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 ...
|
||||
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 ...
|
||||
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)
|
||||
{
|
||||
case SYSTEM_KEY__VOLUME_UP:
|
||||
EWOL_DEBUG("IO keyboard Key System \"VOLUME_UP\" is down=" << keyVal);
|
||||
case org_ewol_EwolConstants_EWOL_SYSTEM_KEY_VOLUME_UP:
|
||||
EWOL_DEBUG("IO keyboard Key System \"VOLUME_UP\" is down=" << isdown);
|
||||
break;
|
||||
case SYSTEM_KEY__VOLUME_DOWN:
|
||||
EWOL_DEBUG("IO keyboard Key System \"VOLUME_DOWN\" is down=" << keyVal);
|
||||
case org_ewol_EwolConstants_EWOL_SYSTEM_KEY_VOLUME_DOWN:
|
||||
EWOL_DEBUG("IO keyboard Key System \"VOLUME_DOWN\" is down=" << isdown);
|
||||
break;
|
||||
case SYSTEM_KEY__MENU:
|
||||
EWOL_DEBUG("IO keyboard Key System \"MENU\" is down=" << keyVal);
|
||||
case org_ewol_EwolConstants_EWOL_SYSTEM_KEY_MENU:
|
||||
EWOL_DEBUG("IO keyboard Key System \"MENU\" is down=" << isdown);
|
||||
break;
|
||||
case SYSTEM_KEY__CAMERA:
|
||||
EWOL_DEBUG("IO keyboard Key System \"CAMERA\" is down=" << keyVal);
|
||||
case org_ewol_EwolConstants_EWOL_SYSTEM_KEY_CAMERA:
|
||||
EWOL_DEBUG("IO keyboard Key System \"CAMERA\" is down=" << isdown);
|
||||
break;
|
||||
case SYSTEM_KEY__HOME:
|
||||
EWOL_DEBUG("IO keyboard Key System \"HOME\" is down=" << keyVal);
|
||||
case org_ewol_EwolConstants_EWOL_SYSTEM_KEY_HOME:
|
||||
EWOL_DEBUG("IO keyboard Key System \"HOME\" is down=" << isdown);
|
||||
break;
|
||||
case SYSTEM_KEY__POWER:
|
||||
EWOL_DEBUG("IO keyboard Key System \"POWER\" is down=" << keyVal);
|
||||
case org_ewol_EwolConstants_EWOL_SYSTEM_KEY_POWER:
|
||||
EWOL_DEBUG("IO keyboard Key System \"POWER\" is down=" << isdown);
|
||||
break;
|
||||
default:
|
||||
EWOL_DEBUG("IO keyboard Key System event : \"" << keyVal << "\" is down=" << isdown);
|
||||
@ -472,23 +419,23 @@ extern "C"
|
||||
/* **********************************************************************************************
|
||||
* ** 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;
|
||||
eSystem::Resize(w, h);
|
||||
}
|
||||
|
||||
void Java_org_ewol_RenderDraw( JNIEnv* env )
|
||||
void Java_org_ewol_Ewol_renderDraw(JNIEnv* env, jobject thiz)
|
||||
{
|
||||
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
|
||||
jboolean isCopy;
|
||||
@ -514,6 +461,7 @@ extern "C"
|
||||
int guiInterface::main(int argc, const char *argv[])
|
||||
{
|
||||
// unneeded fuction, all is controlled by android java ...
|
||||
return 0;
|
||||
}
|
||||
|
||||
int64_t guiInterface::GetTime(void)
|
||||
@ -591,18 +539,18 @@ void guiInterface::Stop(void)
|
||||
|
||||
// java system to send message :
|
||||
void SendSystemMessage(const char * dataString);
|
||||
void SendJava_KeyboardShow(bool showIt);
|
||||
void SendJavaKeyboardUpdate(bool showIt);
|
||||
|
||||
void guiInterface::KeyboardShow(void)
|
||||
{
|
||||
// send a message at the java :
|
||||
SendJava_KeyboardShow(true);
|
||||
SendJavaKeyboardUpdate(true);
|
||||
}
|
||||
|
||||
void guiInterface::KeyboardHide(void)
|
||||
{
|
||||
// send a message at the java :
|
||||
SendJava_KeyboardShow(false);
|
||||
SendJavaKeyboardUpdate(false);
|
||||
}
|
||||
|
||||
void guiInterface::ChangeSize(ivec2 size)
|
||||
@ -622,7 +570,7 @@ void guiInterface::GetAbsPos(ivec2& size)
|
||||
|
||||
void guiInterface::ForceOrientation(ewol::orientation_te orientation)
|
||||
{
|
||||
SendJava_OrientationChange((int32_t)orientation);
|
||||
SendJavaOrientationUpdate((int32_t)orientation);
|
||||
}
|
||||
|
||||
void guiInterface::GrabPointerEvents(bool isGrabbed, vec2 forcedPosition)
|
||||
@ -641,4 +589,3 @@ void guiInterface::SetIcon(etk::UString inputFile)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user