[DEBUG] correct the android port

This commit is contained in:
Edouard DUPIN 2017-04-26 22:16:25 +02:00
parent 46f30152c6
commit 5e65339d82
11 changed files with 40 additions and 15 deletions

View File

@ -202,7 +202,6 @@ class AndroidContext : public gale::Context {
GALE_CRITICAL(" mission one function ==> system can not work withut it..."); GALE_CRITICAL(" mission one function ==> system can not work withut it...");
} }
} }
start2ntThreadProcessing();
} }
~AndroidContext() { ~AndroidContext() {
@ -465,10 +464,30 @@ class AndroidContext : public gale::Context {
} }
void OS_Resize(const vec2& _size) { void OS_Resize(const vec2& _size) {
GALE_VERBOSE("OS_Resize [BEGIN]"); GALE_INFO("OS_Resize [BEGIN]");
m_currentHeight = _size.y(); m_currentHeight = _size.y();
gale::Context::OS_Resize(_size); gale::Context::OS_Resize(_size);
GALE_VERBOSE("OS_Resize [END]"); GALE_INFO("OS_Resize [END]");
}
void ANDROID_start() {
GALE_INFO("ANDROID_start [BEGIN]");
GALE_INFO("ANDROID_start [END]");
}
void ANDROID_reStart() {
GALE_INFO("ANDROID_reStart [BEGIN]");
GALE_INFO("ANDROID_reStart [END]");
}
void ANDROID_create() {
GALE_INFO("ANDROID_create [BEGIN]");
start2ndThreadProcessing();
GALE_INFO("ANDROID_create [END]");
}
void ANDROID_destroy() {
GALE_INFO("ANDROID_destroy [BEGIN]");
GALE_INFO("ANDROID_destroy [END]");
} }
}; };
@ -588,6 +607,7 @@ extern "C" {
// TODO : generate error in java to stop the current instance // TODO : generate error in java to stop the current instance
return; return;
} }
s_listInstance[_id]->ANDROID_create();
//s_listInstance[_id]->init(); //s_listInstance[_id]->init();
} }
@ -603,6 +623,7 @@ extern "C" {
// TODO : generate error in java to stop the current instance // TODO : generate error in java to stop the current instance
return; return;
} }
s_listInstance[_id]->ANDROID_start();
//SendSystemMessage(" testmessages ... "); //SendSystemMessage(" testmessages ... ");
} }
void Java_org_gale_Gale_EWonReStart(JNIEnv* _env, jobject _thiz, jint _id) { void Java_org_gale_Gale_EWonReStart(JNIEnv* _env, jobject _thiz, jint _id) {
@ -617,6 +638,7 @@ extern "C" {
// TODO : generate error in java to stop the current instance // TODO : generate error in java to stop the current instance
return; return;
} }
s_listInstance[_id]->ANDROID_reStart();
} }
void Java_org_gale_Gale_EWonResume(JNIEnv* _env, jobject _thiz, jint _id) { void Java_org_gale_Gale_EWonResume(JNIEnv* _env, jobject _thiz, jint _id) {
std::unique_lock<std::mutex> lock(g_interfaceMutex); std::unique_lock<std::mutex> lock(g_interfaceMutex);
@ -674,6 +696,7 @@ extern "C" {
// TODO : generate error in java to stop the current instance // TODO : generate error in java to stop the current instance
return; return;
} }
s_listInstance[_id]->ANDROID_destroy();
//s_listInstance[_id]->UnInit(); //s_listInstance[_id]->UnInit();
} }

View File

@ -172,6 +172,7 @@ void gale::Context::processEvents() {
} }
void gale::Context::setArchiveDir(int _mode, const char* _str, const char* _applName) { void gale::Context::setArchiveDir(int _mode, const char* _str, const char* _applName) {
GALE_INFO("Set archive DIR : " << _mode << " " << _str << " " << _applName << "[BEGIN]");
switch(_mode) { switch(_mode) {
case 0: case 0:
GALE_DEBUG("Directory APK : path=" << _str); GALE_DEBUG("Directory APK : path=" << _str);
@ -192,6 +193,7 @@ void gale::Context::setArchiveDir(int _mode, const char* _str, const char* _appl
GALE_DEBUG("Directory mode=???? path=" << _str); GALE_DEBUG("Directory mode=???? path=" << _str);
break; break;
} }
GALE_INFO("Set archive DIR : " << _mode << " " << _str << " " << _applName << "[ END ]");
} }
namespace gale { namespace gale {
@ -373,7 +375,7 @@ gale::Context::Context(gale::Application* _application, int32_t _argc, const cha
GALE_INFO(" == > Gale system init (END)"); GALE_INFO(" == > Gale system init (END)");
} }
void gale::Context::start2ntThreadProcessing() { void gale::Context::start2ndThreadProcessing() {
// set the curent interface: // set the curent interface:
lockContext(); lockContext();
m_periodicThread->start(); m_periodicThread->start();

View File

@ -57,7 +57,7 @@ namespace gale {
* @brief StartProcessing (2nd thread). * @brief StartProcessing (2nd thread).
* @note to call when all the Context is started * @note to call when all the Context is started
*/ */
void start2ntThreadProcessing(); void start2ndThreadProcessing();
protected: protected:
/** /**
* @brief set the curent interface. * @brief set the curent interface.

View File

@ -35,7 +35,7 @@ public:
MacOSInterface(gale::Application* _application, int32_t _argc, const char* _argv[]) : MacOSInterface(gale::Application* _application, int32_t _argc, const char* _argv[]) :
gale::Context(_application, _argc, _argv) { gale::Context(_application, _argc, _argv) {
// nothing to do ... // nothing to do ...
start2ntThreadProcessing(); start2ndThreadProcessing();
} }
int32_t Run() { int32_t Run() {

View File

@ -38,7 +38,7 @@ class MacOSInterface : public gale::Context {
MacOSInterface(gale::Application* _application, int _argc, const char* _argv[]) : MacOSInterface(gale::Application* _application, int _argc, const char* _argv[]) :
gale::Context(_application, _argc, _argv) { gale::Context(_application, _argc, _argv) {
mm_main(_argc, _argv); mm_main(_argc, _argv);
start2ntThreadProcessing(); start2ndThreadProcessing();
} }
int32_t Run() { int32_t Run() {

View File

@ -96,7 +96,7 @@ class GLUTInterface : public gale::Context {
GALE_INFO("monitor property : dpi=" << dpi << " px/inch"); GALE_INFO("monitor property : dpi=" << dpi << " px/inch");
} }
m_run = true; m_run = true;
start2ntThreadProcessing(); start2ndThreadProcessing();
} }
~GLUTInterface() { ~GLUTInterface() {

View File

@ -71,7 +71,7 @@ class WindowsContext : public gale::Context {
m_inputIsPressed[iii] = false; m_inputIsPressed[iii] = false;
} }
configure(); configure();
start2ntThreadProcessing(); start2ndThreadProcessing();
} }
~WindowsContext() { ~WindowsContext() {

View File

@ -220,7 +220,7 @@ class X11Interface : public gale::Context {
XAtomGALE = XInternAtom(m_display, m_uniqueWindowsName.c_str(), 0); XAtomGALE = XInternAtom(m_display, m_uniqueWindowsName.c_str(), 0);
XAtomDeleteWindows = XInternAtom(m_display, "WM_DELETE_WINDOW", 0); XAtomDeleteWindows = XInternAtom(m_display, "WM_DELETE_WINDOW", 0);
m_run = true; m_run = true;
start2ntThreadProcessing(); start2ndThreadProcessing();
} }
~X11Interface() { ~X11Interface() {

View File

@ -65,7 +65,7 @@ class SimulationInterface : public gale::Context {
gale::Context(_application, _argc, _argv) { gale::Context(_application, _argc, _argv) {
GALE_INFO("SIMU:INIT"); GALE_INFO("SIMU:INIT");
m_run = true; m_run = true;
start2ntThreadProcessing(); start2ndThreadProcessing();
} }
~SimulationInterface() { ~SimulationInterface() {

View File

@ -329,7 +329,7 @@ class WAYLANDInterface : public gale::Context {
m_uniqueWindowsName = "GALE_" + etk::to_string(etk::tool::irand(0, 1999999999)); m_uniqueWindowsName = "GALE_" + etk::to_string(etk::tool::irand(0, 1999999999));
m_run = true; m_run = true;
GALE_WARNING("WAYLAND: INIT [STOP]"); GALE_WARNING("WAYLAND: INIT [STOP]");
start2ntThreadProcessing(); start2ndThreadProcessing();
} }
~WAYLANDInterface() { ~WAYLANDInterface() {

View File

@ -283,8 +283,8 @@ def tool_generate_main_java_class(target, module, package_name):
tmpFile.write( " \n") tmpFile.write( " \n")
if module.get_pkg("ANDROID_APPL_TYPE")!="APPL": if module.get_pkg("ANDROID_APPL_TYPE")!="APPL":
tmpFile.write( " public Engine onCreateEngine() {\n") tmpFile.write( " public Engine onCreateEngine() {\n")
tmpFile.write( " Engine tmpEngine = super.onCreateEngine();\n")
tmpFile.write( " initApkPath(\"" + module.get_pkg("COMPAGNY_TYPE")+"\", \""+module.get_pkg("COMPAGNY_NAME2")+"\", \"" + application_name + "\", \"" + package_name + "\");\n") tmpFile.write( " initApkPath(\"" + module.get_pkg("COMPAGNY_TYPE")+"\", \""+module.get_pkg("COMPAGNY_NAME2")+"\", \"" + application_name + "\", \"" + package_name + "\");\n")
tmpFile.write( " Engine tmpEngine = super.onCreateEngine();\n")
tmpFile.write( " return tmpEngine;\n") tmpFile.write( " return tmpEngine;\n")
tmpFile.write( " }\n") tmpFile.write( " }\n")
@ -297,12 +297,12 @@ def tool_generate_main_java_class(target, module, package_name):
if module.get_pkg("ANDROID_APPL_TYPE")!="APPL": if module.get_pkg("ANDROID_APPL_TYPE")!="APPL":
tmpFile.write( " public void onCreate() {\n") tmpFile.write( " public void onCreate() {\n")
tmpFile.write( " super.onCreate();\n")
tmpFile.write( " initApkPath(\"" + module.get_pkg("COMPAGNY_TYPE")+"\", \""+module.get_pkg("COMPAGNY_NAME2")+"\", \"" + application_name + "\", \"" + package_name + "\");\n") tmpFile.write( " initApkPath(\"" + module.get_pkg("COMPAGNY_TYPE")+"\", \""+module.get_pkg("COMPAGNY_NAME2")+"\", \"" + application_name + "\", \"" + package_name + "\");\n")
tmpFile.write( " super.onCreate();\n")
else: else:
tmpFile.write( " public void onCreate(android.os.Bundle savedInstanceState) {\n") tmpFile.write( " public void onCreate(android.os.Bundle savedInstanceState) {\n")
tmpFile.write( " super.onCreate(savedInstanceState);\n")
tmpFile.write( " initApkPath(\"" + module.get_pkg("COMPAGNY_TYPE")+"\", \""+module.get_pkg("COMPAGNY_NAME2")+"\", \"" + application_name + "\", \"" + package_name + "\");\n") tmpFile.write( " initApkPath(\"" + module.get_pkg("COMPAGNY_TYPE")+"\", \""+module.get_pkg("COMPAGNY_NAME2")+"\", \"" + application_name + "\", \"" + package_name + "\");\n")
tmpFile.write( " super.onCreate(savedInstanceState);\n")
if module.get_pkg("GENERATE_SECTION__ON_CREATE") != None: if module.get_pkg("GENERATE_SECTION__ON_CREATE") != None:
for elem in module.get_pkg("GENERATE_SECTION__ON_CREATE"): for elem in module.get_pkg("GENERATE_SECTION__ON_CREATE"):