2011-12-14 13:57:46 +01:00
|
|
|
/**
|
|
|
|
*******************************************************************************
|
|
|
|
* @file ewolAndroidAbstraction.cpp
|
|
|
|
* @brief User abstraction for Android (Sources)
|
|
|
|
* @author Edouard DUPIN
|
|
|
|
* @date 14/12/2011
|
|
|
|
* @par Project
|
|
|
|
* ewol
|
|
|
|
*
|
|
|
|
* @par Copyright
|
|
|
|
* Copyright 2011 Edouard DUPIN, all right reserved
|
|
|
|
*
|
|
|
|
* This software is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY.
|
|
|
|
*
|
|
|
|
* Licence summary :
|
|
|
|
* You can modify and redistribute the sources code and binaries.
|
|
|
|
* You can send me the bug-fix
|
|
|
|
*
|
|
|
|
* Term of the licence in in the file licence.txt.
|
|
|
|
*
|
|
|
|
*******************************************************************************
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <jni.h>
|
|
|
|
#include <sys/time.h>
|
|
|
|
#include <time.h>
|
|
|
|
#include <stdint.h>
|
2012-01-26 18:13:15 +01:00
|
|
|
#include <pthread.h>
|
2012-04-11 01:33:24 +02:00
|
|
|
#include <Debug.h>
|
2012-01-26 18:13:15 +01:00
|
|
|
|
|
|
|
#include <ewol/threadMsg.h>
|
2011-12-14 13:57:46 +01:00
|
|
|
|
|
|
|
// declaration of the ewol android abstraction ...
|
2012-01-31 18:27:35 +01:00
|
|
|
|
|
|
|
void EWOL_SystemStart(void);
|
|
|
|
void EWOL_SystemStop(void);
|
|
|
|
void EWOL_ThreadSetArchiveDir(int mode, const char* str);
|
|
|
|
void EWOL_ThreadResize(int w, int h );
|
|
|
|
void EWOL_ThreadEventInputMotion(int pointerID, float x, float y);
|
|
|
|
void EWOL_ThreadEventInputState(int pointerID, bool isUp, float x, float y);
|
2012-05-21 18:10:00 +02:00
|
|
|
void EWOL_ThreadEventMouseMotion(int pointerID, float x, float y);
|
|
|
|
void EWOL_ThreadEventMouseState(int pointerID, bool isUp, float x, float y);
|
2012-01-31 22:35:40 +01:00
|
|
|
void EWOL_NativeRender(void);
|
2012-02-02 23:22:41 +01:00
|
|
|
void EWOL_NativeGLDestroy(void);
|
2011-12-14 13:57:46 +01:00
|
|
|
|
2012-04-18 18:14:13 +02:00
|
|
|
// get a resources from the java environement :
|
|
|
|
static JNIEnv* JavaVirtualMachinePointer = NULL; // the JVM
|
|
|
|
static jclass javaClassActivity = 0; // main activity class (android ...)
|
2012-04-19 18:11:19 +02:00
|
|
|
static jobject javaObjectActivity = 0;
|
2012-04-18 18:14:13 +02:00
|
|
|
static jmethodID javaClassActivityEntryPoint = 0; // basic methode to call ...
|
2012-04-19 18:11:19 +02:00
|
|
|
static jmethodID javaClassActivityEntryPoint__CPP_keyboardShow = 0; // basic methode to call ...
|
2012-04-20 17:56:23 +02:00
|
|
|
static jmethodID javaClassActivityEntryPoint__CPP_keyboardHide = 0; // basic methode to call ...
|
2012-04-18 18:14:13 +02:00
|
|
|
// generic classes
|
|
|
|
static jclass javaDefaultClassString = 0; // default string class
|
|
|
|
|
|
|
|
|
|
|
|
static JavaVM* g_JavaVM = NULL;
|
|
|
|
|
2012-04-19 18:11:19 +02:00
|
|
|
// jni doc : /usr/lib/jvm/java-1.6.0-openjdk/include
|
2012-04-18 18:14:13 +02:00
|
|
|
|
2012-04-19 18:11:19 +02:00
|
|
|
|
2012-04-20 17:56:23 +02:00
|
|
|
void SendJava_KeyboardShow(bool showIt)
|
2012-04-18 18:14:13 +02:00
|
|
|
{
|
2012-04-19 18:11:19 +02:00
|
|
|
APPL_DEBUG("C->java : call java");
|
2012-04-18 18:14:13 +02:00
|
|
|
if (NULL == g_JavaVM) {
|
|
|
|
APPL_DEBUG("C->java : JVM not initialised");
|
|
|
|
return;
|
|
|
|
}
|
2012-04-19 18:11:19 +02:00
|
|
|
JNIEnv *JavaVirtualMachinePointer_tmp;
|
|
|
|
int status = g_JavaVM->GetEnv((void **) &JavaVirtualMachinePointer_tmp, JNI_VERSION_1_6);
|
2012-04-18 18:14:13 +02:00
|
|
|
if (status == JNI_EDETACHED) {
|
2012-04-19 18:11:19 +02:00
|
|
|
JavaVMAttachArgs lJavaVMAttachArgs;
|
|
|
|
lJavaVMAttachArgs.version = JNI_VERSION_1_6;
|
|
|
|
lJavaVMAttachArgs.name = "EwolNativeThread";
|
|
|
|
lJavaVMAttachArgs.group = NULL;
|
|
|
|
status = g_JavaVM->AttachCurrentThread(&JavaVirtualMachinePointer_tmp, &lJavaVMAttachArgs);
|
2012-04-18 18:14:13 +02:00
|
|
|
if (status != JNI_OK) {
|
|
|
|
APPL_DEBUG("C->java : AttachCurrentThread failed : " << status);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (JavaVirtualMachinePointer->ExceptionOccurred()) {
|
2012-04-19 18:11:19 +02:00
|
|
|
APPL_DEBUG("C->java : EXEPTION ...");
|
2012-04-18 18:14:13 +02:00
|
|
|
JavaVirtualMachinePointer->ExceptionDescribe();
|
2012-04-19 18:11:19 +02:00
|
|
|
JavaVirtualMachinePointer->ExceptionClear();
|
2012-04-18 18:14:13 +02:00
|
|
|
}
|
|
|
|
}
|
2012-04-19 18:11:19 +02:00
|
|
|
if (JavaVirtualMachinePointer->ExceptionOccurred()) {
|
|
|
|
APPL_DEBUG("C->java : EXEPTION ...");
|
|
|
|
JavaVirtualMachinePointer->ExceptionDescribe();
|
|
|
|
JavaVirtualMachinePointer->ExceptionClear();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (NULL == JavaVirtualMachinePointer) {
|
|
|
|
APPL_DEBUG("C->java : JVM not initialised");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
//Call java ...
|
2012-04-20 17:56:23 +02:00
|
|
|
if (true == showIt) {
|
|
|
|
JavaVirtualMachinePointer->CallVoidMethod(javaObjectActivity, javaClassActivityEntryPoint__CPP_keyboardShow);
|
|
|
|
} else {
|
|
|
|
JavaVirtualMachinePointer->CallVoidMethod(javaObjectActivity, javaClassActivityEntryPoint__CPP_keyboardHide);
|
|
|
|
}
|
2012-04-18 18:14:13 +02:00
|
|
|
|
2012-04-19 18:11:19 +02:00
|
|
|
// manage execption :
|
|
|
|
if (JavaVirtualMachinePointer->ExceptionOccurred()) {
|
|
|
|
APPL_DEBUG("C->java : EXEPTION ...");
|
|
|
|
JavaVirtualMachinePointer->ExceptionDescribe();
|
|
|
|
JavaVirtualMachinePointer->ExceptionClear();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Finished with the JVM.
|
|
|
|
g_JavaVM->DetachCurrentThread();
|
|
|
|
}
|
2012-04-18 18:14:13 +02:00
|
|
|
|
2012-04-19 18:11:19 +02:00
|
|
|
void SendSystemMessage(const char * dataString)
|
|
|
|
{
|
|
|
|
APPL_DEBUG("C->java : send message to the java : \"" << dataString << "\"");
|
|
|
|
if (NULL == g_JavaVM) {
|
|
|
|
APPL_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) {
|
|
|
|
APPL_DEBUG("C->java : AttachCurrentThread failed : " << status);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
APPL_DEBUG("C->java : 111");
|
2012-04-18 18:14:13 +02:00
|
|
|
if (NULL == JavaVirtualMachinePointer) {
|
|
|
|
APPL_DEBUG("C->java : JVM not initialised");
|
|
|
|
return;
|
|
|
|
}
|
2012-04-19 18:11:19 +02:00
|
|
|
APPL_DEBUG("C->java : 222");
|
|
|
|
if (NULL == dataString) {
|
|
|
|
APPL_DEBUG("C->java : No data to send ...");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
APPL_DEBUG("C->java : 333");
|
2012-04-18 18:14:13 +02:00
|
|
|
// create the string to the java
|
|
|
|
jstring jstr = JavaVirtualMachinePointer->NewStringUTF(dataString);
|
|
|
|
if (jstr == 0) {
|
|
|
|
APPL_DEBUG("C->java : Out of memory" );
|
|
|
|
return;
|
|
|
|
}
|
2012-04-19 18:11:19 +02:00
|
|
|
APPL_DEBUG("C->java : 444");
|
2012-04-18 18:14:13 +02:00
|
|
|
// create argument list
|
|
|
|
jobjectArray args = JavaVirtualMachinePointer->NewObjectArray(1, javaDefaultClassString, jstr);
|
|
|
|
if (args == 0) {
|
|
|
|
APPL_DEBUG("C->java : Out of memory" );
|
|
|
|
return;
|
|
|
|
}
|
2012-04-19 18:11:19 +02:00
|
|
|
APPL_DEBUG("C->java : 555");
|
2012-04-18 18:14:13 +02:00
|
|
|
//Call java ...
|
|
|
|
JavaVirtualMachinePointer->CallStaticVoidMethod(javaClassActivity, javaClassActivityEntryPoint, args);
|
|
|
|
|
2012-04-19 18:11:19 +02:00
|
|
|
APPL_DEBUG("C->java : 666");
|
2012-04-18 18:14:13 +02:00
|
|
|
// manage execption :
|
|
|
|
if (JavaVirtualMachinePointer->ExceptionOccurred()) {
|
|
|
|
JavaVirtualMachinePointer->ExceptionDescribe();
|
2012-04-19 18:11:19 +02:00
|
|
|
JavaVirtualMachinePointer->ExceptionClear();
|
2012-04-18 18:14:13 +02:00
|
|
|
}
|
2012-04-19 18:11:19 +02:00
|
|
|
|
|
|
|
// Finished with the JVM.
|
|
|
|
g_JavaVM->DetachCurrentThread();
|
2012-04-18 18:14:13 +02:00
|
|
|
}
|
|
|
|
|
2012-04-20 17:56:23 +02:00
|
|
|
namespace guiAbstraction {
|
|
|
|
void SendKeyboardEvent(bool isDown, uniChar_t keyInput);
|
|
|
|
};
|
2012-01-27 02:05:26 +01:00
|
|
|
|
2011-12-14 13:57:46 +01:00
|
|
|
extern "C"
|
|
|
|
{
|
2012-04-18 18:14:13 +02:00
|
|
|
// JNI OnLoad
|
|
|
|
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* jvm, void* reserved)
|
|
|
|
{
|
|
|
|
// get the java virtual machine handle ...
|
|
|
|
g_JavaVM = jvm;
|
|
|
|
APPL_DEBUG("JNI-> load the jvm ..." );
|
|
|
|
return JNI_VERSION_1_6;
|
|
|
|
}
|
|
|
|
// JNI OnUnLoad
|
|
|
|
JNIEXPORT void JNICALL JNI_OnUnload(JavaVM *vm, void *reserved)
|
|
|
|
{
|
|
|
|
g_JavaVM = NULL;
|
|
|
|
APPL_DEBUG("JNI-> Un-load the jvm ..." );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-12-14 13:57:46 +01:00
|
|
|
/* Call to initialize the graphics state */
|
2012-01-27 02:05:26 +01:00
|
|
|
|
|
|
|
void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE_____PROJECT_NAME___ActivityParamSetArchiveDir( JNIEnv* env, jobject thiz, jint mode, jstring myString)
|
|
|
|
{
|
|
|
|
// direct setting of the date in the string system ...
|
2012-04-19 18:11:19 +02:00
|
|
|
jboolean isCopy;
|
|
|
|
const char* str = env->GetStringUTFChars(myString, &isCopy);
|
2012-01-27 12:43:36 +01:00
|
|
|
EWOL_ThreadSetArchiveDir(mode, str);
|
2012-04-19 18:11:19 +02:00
|
|
|
if (isCopy == JNI_TRUE) {
|
|
|
|
// from here str is reset ...
|
|
|
|
env->ReleaseStringUTFChars(myString, str);
|
|
|
|
str = NULL;
|
|
|
|
}
|
2012-01-27 02:05:26 +01:00
|
|
|
}
|
|
|
|
|
2012-04-19 18:11:19 +02:00
|
|
|
void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE_____PROJECT_NAME___ActivitySetJavaVortualMachineStart( JNIEnv* env, jclass classBase, jobject obj)
|
|
|
|
//void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE_____PROJECT_NAME___ActivitySetJavaVortualMachineStart( JNIEnv* env)
|
2012-04-18 18:14:13 +02:00
|
|
|
{
|
|
|
|
APPL_DEBUG("*******************************************");
|
|
|
|
APPL_DEBUG("** Set JVM Pointer **");
|
|
|
|
APPL_DEBUG("*******************************************");
|
|
|
|
JavaVirtualMachinePointer = env;
|
|
|
|
// get default needed all time elements :
|
|
|
|
if (NULL != JavaVirtualMachinePointer) {
|
2012-04-19 18:11:19 +02:00
|
|
|
javaClassActivity = JavaVirtualMachinePointer->FindClass("com/__PROJECT_VENDOR__/__PROJECT_PACKAGE__/__PROJECT_NAME__" );
|
2012-04-18 18:14:13 +02:00
|
|
|
if (javaClassActivity == 0) {
|
2012-04-19 18:11:19 +02:00
|
|
|
APPL_DEBUG("C->java : Can't find com/__PROJECT_VENDOR__/__PROJECT_PACKAGE__/__PROJECT_NAME__ class");
|
2012-04-18 18:14:13 +02:00
|
|
|
// remove access on the virtual machine :
|
|
|
|
JavaVirtualMachinePointer = NULL;
|
|
|
|
return;
|
|
|
|
}
|
2012-04-19 18:11:19 +02:00
|
|
|
// get the activity object :
|
2012-04-18 18:14:13 +02:00
|
|
|
javaClassActivityEntryPoint = JavaVirtualMachinePointer->GetStaticMethodID(javaClassActivity, "eventFromCPP", "([Ljava/lang/String;)V" );
|
|
|
|
if (javaClassActivityEntryPoint == 0) {
|
2012-04-19 18:11:19 +02:00
|
|
|
APPL_DEBUG("C->java : Can't find com/__PROJECT_VENDOR__/__PROJECT_PACKAGE__/__PROJECT_NAME__.eventFromCPP" );
|
2012-04-18 18:14:13 +02:00
|
|
|
// remove access on the virtual machine :
|
|
|
|
JavaVirtualMachinePointer = NULL;
|
|
|
|
return;
|
|
|
|
}
|
2012-04-19 18:11:19 +02:00
|
|
|
javaClassActivityEntryPoint__CPP_keyboardShow = JavaVirtualMachinePointer->GetMethodID(javaClassActivity, "CPP_keyboardShow", "()V" );
|
2012-04-20 17:56:23 +02:00
|
|
|
if (javaClassActivityEntryPoint__CPP_keyboardShow == 0) {
|
2012-04-19 18:11:19 +02:00
|
|
|
APPL_DEBUG("C->java : Can't find com/__PROJECT_VENDOR__/__PROJECT_PACKAGE__/__PROJECT_NAME__.CPP_keyboardShow" );
|
|
|
|
// remove access on the virtual machine :
|
|
|
|
JavaVirtualMachinePointer = NULL;
|
|
|
|
return;
|
|
|
|
}
|
2012-04-20 17:56:23 +02:00
|
|
|
javaClassActivityEntryPoint__CPP_keyboardHide = JavaVirtualMachinePointer->GetMethodID(javaClassActivity, "CPP_keyboardHide", "()V" );
|
|
|
|
if (javaClassActivityEntryPoint__CPP_keyboardHide == 0) {
|
|
|
|
APPL_DEBUG("C->java : Can't find com/__PROJECT_VENDOR__/__PROJECT_PACKAGE__/__PROJECT_NAME__.CPP_keyboardHide" );
|
|
|
|
// remove access on the virtual machine :
|
|
|
|
JavaVirtualMachinePointer = NULL;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
//javaObjectActivity = JavaVirtualMachinePointer->NewGlobalRef(obj);
|
|
|
|
javaObjectActivity = obj;
|
2012-04-19 18:11:19 +02:00
|
|
|
|
2012-04-18 18:14:13 +02:00
|
|
|
javaDefaultClassString = JavaVirtualMachinePointer->FindClass("java/lang/String" );
|
|
|
|
if (javaDefaultClassString == 0) {
|
|
|
|
APPL_DEBUG("C->java : Can't find java/lang/String" );
|
|
|
|
// remove access on the virtual machine :
|
|
|
|
JavaVirtualMachinePointer = NULL;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE_____PROJECT_NAME___ActivitySetJavaVortualMachineStop( JNIEnv* env )
|
|
|
|
{
|
|
|
|
APPL_DEBUG("*******************************************");
|
|
|
|
APPL_DEBUG("** Remove JVM Pointer **");
|
|
|
|
APPL_DEBUG("*******************************************");
|
|
|
|
JavaVirtualMachinePointer = NULL;
|
|
|
|
}
|
2012-04-20 17:56:23 +02:00
|
|
|
void Java_org_ewol_interfaceJNI_TouchEvent( JNIEnv* env )
|
2012-04-18 18:14:13 +02:00
|
|
|
{
|
|
|
|
APPL_DEBUG(" ==> Touch Event");
|
2012-04-19 18:11:19 +02:00
|
|
|
if (env->ExceptionOccurred()) {
|
|
|
|
env->ExceptionDescribe();
|
|
|
|
env->ExceptionClear();
|
|
|
|
}
|
2012-04-18 18:14:13 +02:00
|
|
|
}
|
|
|
|
|
2012-04-20 17:56:23 +02:00
|
|
|
void Java_org_ewol_interfaceJNI_ActivityOnCreate( JNIEnv* env )
|
2011-12-14 13:57:46 +01:00
|
|
|
{
|
2012-04-11 01:33:24 +02:00
|
|
|
APPL_DEBUG("*******************************************");
|
|
|
|
APPL_DEBUG("** Activity On Create **");
|
|
|
|
APPL_DEBUG("*******************************************");
|
2012-01-31 18:27:35 +01:00
|
|
|
EWOL_SystemStart();
|
2012-01-27 02:05:26 +01:00
|
|
|
}
|
2012-04-20 17:56:23 +02:00
|
|
|
void Java_org_ewol_interfaceJNI_ActivityOnStart( JNIEnv* env )
|
2012-01-27 02:05:26 +01:00
|
|
|
{
|
2012-04-11 01:33:24 +02:00
|
|
|
APPL_DEBUG("*******************************************");
|
|
|
|
APPL_DEBUG("** Activity On Start **");
|
|
|
|
APPL_DEBUG("*******************************************");
|
2012-04-18 18:14:13 +02:00
|
|
|
//SendSystemMessage(" testmessages ... ");
|
2012-01-27 02:05:26 +01:00
|
|
|
}
|
2012-04-20 17:56:23 +02:00
|
|
|
void Java_org_ewol_interfaceJNI_ActivityOnReStart( JNIEnv* env )
|
2012-01-27 02:05:26 +01:00
|
|
|
{
|
2012-04-11 01:33:24 +02:00
|
|
|
APPL_DEBUG("*******************************************");
|
|
|
|
APPL_DEBUG("** Activity On Re-Start **");
|
|
|
|
APPL_DEBUG("*******************************************");
|
2012-01-27 02:05:26 +01:00
|
|
|
}
|
2012-04-20 17:56:23 +02:00
|
|
|
void Java_org_ewol_interfaceJNI_ActivityOnResume( JNIEnv* env )
|
2012-01-27 02:05:26 +01:00
|
|
|
{
|
2012-04-11 01:33:24 +02:00
|
|
|
APPL_DEBUG("*******************************************");
|
|
|
|
APPL_DEBUG("** Activity On Resume **");
|
|
|
|
APPL_DEBUG("*******************************************");
|
2012-01-27 02:05:26 +01:00
|
|
|
}
|
2012-04-20 17:56:23 +02:00
|
|
|
void Java_org_ewol_interfaceJNI_ActivityOnPause( JNIEnv* env )
|
2012-01-27 02:05:26 +01:00
|
|
|
{
|
2012-04-11 01:33:24 +02:00
|
|
|
APPL_DEBUG("*******************************************");
|
|
|
|
APPL_DEBUG("** Activity On Pause **");
|
|
|
|
APPL_DEBUG("*******************************************");
|
2012-02-02 23:22:41 +01:00
|
|
|
// All the openGl has been destroyed ...
|
|
|
|
// TODO : Mark all the texture to be reloaded ...
|
|
|
|
EWOL_NativeGLDestroy();
|
2012-01-27 02:05:26 +01:00
|
|
|
}
|
2012-04-20 17:56:23 +02:00
|
|
|
void Java_org_ewol_interfaceJNI_ActivityOnStop( JNIEnv* env )
|
2012-01-27 02:05:26 +01:00
|
|
|
{
|
2012-04-11 01:33:24 +02:00
|
|
|
APPL_DEBUG("*******************************************");
|
|
|
|
APPL_DEBUG("** Activity On Stop **");
|
|
|
|
APPL_DEBUG("*******************************************");
|
2012-01-27 02:05:26 +01:00
|
|
|
}
|
2012-04-20 17:56:23 +02:00
|
|
|
void Java_org_ewol_interfaceJNI_ActivityOnDestroy( JNIEnv* env )
|
2012-01-27 02:05:26 +01:00
|
|
|
{
|
2012-04-11 01:33:24 +02:00
|
|
|
APPL_DEBUG("*******************************************");
|
|
|
|
APPL_DEBUG("** Activity On Destroy **");
|
|
|
|
APPL_DEBUG("*******************************************");
|
2012-01-31 18:27:35 +01:00
|
|
|
EWOL_SystemStop();
|
2011-12-14 13:57:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-04-20 17:56:23 +02:00
|
|
|
|
|
|
|
/* **********************************************************************************************
|
|
|
|
* ** IO section :
|
|
|
|
* ********************************************************************************************** */
|
|
|
|
void Java_org_ewol_interfaceJNI_IOInputEventMotion( JNIEnv* env, jobject thiz, jint pointerID, jfloat x, jfloat y )
|
2011-12-14 13:57:46 +01:00
|
|
|
{
|
2012-04-20 17:56:23 +02:00
|
|
|
EWOL_ThreadEventInputMotion(pointerID+1, x, y);
|
2011-12-14 13:57:46 +01:00
|
|
|
}
|
|
|
|
|
2012-04-20 17:56:23 +02:00
|
|
|
void Java_org_ewol_interfaceJNI_IOInputEventState( JNIEnv* env, jobject thiz, jint pointerID, jboolean isUp, jfloat x, jfloat y )
|
|
|
|
{
|
|
|
|
EWOL_ThreadEventInputState(pointerID+1, isUp, x, y);
|
|
|
|
}
|
2012-01-27 02:05:26 +01:00
|
|
|
|
2012-05-21 13:53:33 +02:00
|
|
|
void Java_org_ewol_interfaceJNI_IOMouseEventMotion( JNIEnv* env, jobject thiz, jint pointerID, jfloat x, jfloat y )
|
|
|
|
{
|
2012-05-21 18:10:00 +02:00
|
|
|
EWOL_ThreadEventMouseMotion(pointerID+1, x, y);
|
2012-05-21 13:53:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void Java_org_ewol_interfaceJNI_IOMouseEventState( JNIEnv* env, jobject thiz, jint pointerID, jboolean isUp, jfloat x, jfloat y )
|
|
|
|
{
|
2012-05-21 18:10:00 +02:00
|
|
|
EWOL_ThreadEventMouseState(pointerID+1, isUp, x, y);
|
2012-05-21 13:53:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void Java_org_ewol_interfaceJNI_IOUnknowEvent( JNIEnv* env, jobject thiz, jint pointerID)
|
2011-12-14 13:57:46 +01:00
|
|
|
{
|
2012-04-20 17:56:23 +02:00
|
|
|
APPL_DEBUG("Unknown IO event : " << pointerID << " ???");
|
2011-12-14 13:57:46 +01:00
|
|
|
}
|
|
|
|
|
2012-04-20 17:56:23 +02:00
|
|
|
void Java_org_ewol_interfaceJNI_IOKeyboardEventMove( JNIEnv* env, jobject thiz, jint type, jboolean isdown)
|
2011-12-14 13:57:46 +01:00
|
|
|
{
|
2012-04-20 17:56:23 +02:00
|
|
|
APPL_DEBUG("IO keyboard Move event : \"" << type << "\" is down=" << isdown);
|
2011-12-14 13:57:46 +01:00
|
|
|
}
|
|
|
|
|
2012-04-20 17:56:23 +02:00
|
|
|
void Java_org_ewol_interfaceJNI_IOKeyboardEventKey( JNIEnv* env, jobject thiz, jint uniChar, jboolean isdown)
|
2011-12-14 13:57:46 +01:00
|
|
|
{
|
2012-04-20 17:56:23 +02:00
|
|
|
APPL_DEBUG("IO keyboard Key event : \"" << uniChar << "\" is down=" << isdown);
|
|
|
|
guiAbstraction::SendKeyboardEvent(isdown, uniChar);
|
|
|
|
}
|
|
|
|
enum {
|
|
|
|
SYSTEM_KEY__VOLUME_UP = 1,
|
|
|
|
SYSTEM_KEY__VOLUME_DOWN,
|
|
|
|
SYSTEM_KEY__MENU,
|
|
|
|
SYSTEM_KEY__CAMERA,
|
|
|
|
SYSTEM_KEY__HOME,
|
|
|
|
SYSTEM_KEY__POWER,
|
|
|
|
};
|
|
|
|
void Java_org_ewol_interfaceJNI_IOKeyboardEventKeySystem( JNIEnv* env, jobject thiz, jint keyVal, jboolean isdown)
|
|
|
|
{
|
|
|
|
switch (keyVal)
|
|
|
|
{
|
|
|
|
case SYSTEM_KEY__VOLUME_UP:
|
|
|
|
APPL_DEBUG("IO keyboard Key System \"VOLUME_UP\" is down=" << keyVal);
|
|
|
|
break;
|
|
|
|
case SYSTEM_KEY__VOLUME_DOWN:
|
|
|
|
APPL_DEBUG("IO keyboard Key System \"VOLUME_DOWN\" is down=" << keyVal);
|
|
|
|
break;
|
|
|
|
case SYSTEM_KEY__MENU:
|
|
|
|
APPL_DEBUG("IO keyboard Key System \"MENU\" is down=" << keyVal);
|
|
|
|
break;
|
|
|
|
case SYSTEM_KEY__CAMERA:
|
|
|
|
APPL_DEBUG("IO keyboard Key System \"CAMERA\" is down=" << keyVal);
|
|
|
|
break;
|
|
|
|
case SYSTEM_KEY__HOME:
|
|
|
|
APPL_DEBUG("IO keyboard Key System \"HOME\" is down=" << keyVal);
|
|
|
|
break;
|
|
|
|
case SYSTEM_KEY__POWER:
|
|
|
|
APPL_DEBUG("IO keyboard Key System \"POWER\" is down=" << keyVal);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
APPL_DEBUG("IO keyboard Key System event : \"" << keyVal << "\" is down=" << isdown);
|
|
|
|
break;
|
|
|
|
}
|
2011-12-14 13:57:46 +01:00
|
|
|
}
|
|
|
|
|
2011-12-14 14:10:02 +01:00
|
|
|
|
2012-04-20 17:56:23 +02:00
|
|
|
/* **********************************************************************************************
|
|
|
|
* ** Renderer section :
|
|
|
|
* ********************************************************************************************** */
|
|
|
|
void Java_org_ewol_interfaceJNI_RenderInit( JNIEnv* env )
|
2011-12-14 13:57:46 +01:00
|
|
|
{
|
2012-04-20 17:56:23 +02:00
|
|
|
|
2011-12-14 13:57:46 +01:00
|
|
|
}
|
|
|
|
|
2012-04-20 17:56:23 +02:00
|
|
|
void Java_org_ewol_interfaceJNI_RenderResize( JNIEnv* env, jobject thiz, jint w, jint h )
|
2011-12-14 13:57:46 +01:00
|
|
|
{
|
2012-04-20 17:56:23 +02:00
|
|
|
EWOL_ThreadResize(w, h);
|
2011-12-14 13:57:46 +01:00
|
|
|
}
|
|
|
|
|
2012-04-20 17:56:23 +02:00
|
|
|
void Java_org_ewol_interfaceJNI_RenderDraw( JNIEnv* env )
|
2011-12-14 13:57:46 +01:00
|
|
|
{
|
2012-01-27 02:05:26 +01:00
|
|
|
EWOL_NativeRender();
|
2011-12-14 13:57:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|