[DEV] add main start for Other platform (not tested)

This commit is contained in:
Edouard DUPIN 2014-06-05 22:05:32 +02:00
parent e7cc0e7100
commit 76e20869b5
4 changed files with 26 additions and 18 deletions

View File

@ -87,7 +87,8 @@ class AndroidContext : public ewol::Context {
return true;
}
public:
AndroidContext(JNIEnv* _env, jclass _classBase, jobject _objCallback, enum application _typeAPPL) :
AndroidContext(ewol::context::Application* _application, JNIEnv* _env, jclass _classBase, jobject _objCallback, enum application _typeAPPL) :
ewol::Context(_application),
m_javaApplicationType(_typeAPPL),
m_JavaVirtualMachinePointer(nullptr),
m_javaClassEwol(0),
@ -639,6 +640,7 @@ class AndroidContext : public ewol::Context {
};
static std::vector<AndroidContext*> s_listInstance;
ewol::context::Application* s_applicationInit = NULL;
extern "C" {
// JNI onLoad
@ -693,10 +695,16 @@ extern "C" {
EWOL_DEBUG("** Creating EWOL context **");
EWOL_DEBUG("*******************************************");
AndroidContext* tmpContext = nullptr;
s_applicationInit = NULL;
ewol::context::Application* localApplication = NULL;
// call the basic init of all application (that call us ...)
main(0,NULL);
localApplication = s_applicationInit;
s_applicationInit = NULL;
if (org_ewol_EwolConstants_EWOL_APPL_TYPE_ACTIVITY == _typeApplication) {
tmpContext = new AndroidContext(_env, _classBase, _objCallback, AndroidContext::appl_application);
tmpContext = new AndroidContext(localApplication, _env, _classBase, _objCallback, AndroidContext::appl_application);
} else if (org_ewol_EwolConstants_EWOL_APPL_TYPE_WALLPAPER == _typeApplication) {
tmpContext = new AndroidContext(_env, _classBase, _objCallback, AndroidContext::appl_wallpaper);
tmpContext = new AndroidContext(localApplication, _env, _classBase, _objCallback, AndroidContext::appl_wallpaper);
} else {
EWOL_CRITICAL(" try to create an instance with no apply type: " << _typeApplication);
return -1;
@ -1106,7 +1114,7 @@ extern "C" {
};
int ewol::run(int _argc, const char *_argv[]) {
// Never call but needed ...
return -1;
int ewol::run(ewol::context::Application* _application, int _argc, const char *_argv[]) {
s_applicationInit = _application;
return 0;
}

View File

@ -53,8 +53,8 @@ class MacOSInterface : public ewol::Context {
private:
ewol::key::Special m_guiKeyBoardMode;
public:
MacOSInterface(int32_t _argc, const char* _argv[]) :
ewol::Context(_argc, _argv) {
MacOSInterface(ewol::context::Application* _application, int32_t _argc, const char* _argv[]) :
ewol::Context(_application, _argc, _argv) {
// nothing to do ...
}
@ -237,10 +237,10 @@ static const char **l_argv = nullptr;
* @param std IO
* @return std IO
*/
int ewol::run(int _argc, const char *_argv[]) {
int ewol::run(ewol::context::Application* _application, int _argc, const char *_argv[]) {
l_argc = _argc;
l_argv = _argv;
return mm_main(_argc, _argv);
return mm_main(_application, _argc, _argv);
}
// Creat and relaese ewol::Context interface:

View File

@ -53,8 +53,8 @@ class MacOSInterface : public ewol::Context {
private:
ewol::key::Special m_guiKeyBoardMode;
public:
MacOSInterface(int32_t _argc, const char* _argv[]) :
ewol::Context(_argc, _argv) {
MacOSInterface(ewol::context::Application* _application, int32_t _argc, const char* _argv[]) :
ewol::Context(_application, _argc, _argv) {
mm_main(_argc, _argv);
}
@ -172,9 +172,9 @@ void MacOs::setKeyboardMove(ewol::key::Special& _keyboardMode, enum ewol::key::k
* @param std IO
* @return std IO
*/
int ewol::run(int _argc, const char *_argv[]) {
int ewol::run(ewol::context::Application* _application, int _argc, const char *_argv[]) {
etk::setArgZero(_argv[0]);
interface = new MacOSInterface(_argc, _argv);
interface = new MacOSInterface(_application, _argc, _argv);
if (nullptr == interface) {
EWOL_CRITICAL("Can not create the X11 interface ... MEMORY allocation error");
return -2;

View File

@ -47,8 +47,8 @@ class WindowsContext : public ewol::eContext {
bool m_run = true;
bool m_clipBoardOwnerStd = false;
public:
WindowsContext(int32_t _argc, char* _argv[]) :
ewol::eContext(_argc, _argv) {
WindowsContext(ewol::context::Application* _application, int32_t _argc, char* _argv[]) :
ewol::eContext(_application, _argc, _argv) {
for (int32_t iii=0; iii<MAX_MANAGE_INPUT; ++iii) {
m_inputIsPressed[iii] = false;
}
@ -454,7 +454,7 @@ class WindowsContext : public ewol::eContext {
* @param std IO
* @return std IO
*/
int ewol::Run(int _argc, const char *_argv[]) {
int ewol::Run(ewol::context::Application* _application, int _argc, const char *_argv[]) {
GLenum err = glewInit();
if (GLEW_OK != err) {
/* Problem: glewInit failed, something is seriously wrong. */
@ -464,7 +464,7 @@ int ewol::Run(int _argc, const char *_argv[]) {
EWOL_ERROR("OpenGL 2.0 not available");
//return 1;
}
WindowsContext* interface = new WindowsContext(_argc, _argv);
WindowsContext* interface = new WindowsContext(_application, _argc, _argv);
if (nullptr == interface) {
EWOL_CRITICAL("Can not create the X11 interface ... MEMORY allocation error");
return -2;