From df0695a9d86227b84fd95e07f3c9a8eeeb16ea7e Mon Sep 17 00:00:00 2001 From: Kiritow <1362050620@qq.com> Date: Wed, 4 Jan 2017 00:19:46 +0800 Subject: [PATCH] Fix Bug on C4droid --- InitManager.cpp | 4 ++++ InitManager.h | 8 ++++---- basic_config.h | 4 ++++ main.cpp | 8 ++------ mini_engine.cpp | 19 +++++++++++++++++++ mini_engine.h | 3 +++ 6 files changed, 36 insertions(+), 10 deletions(-) diff --git a/InitManager.cpp b/InitManager.cpp index 89ac0ac..a31554c 100644 --- a/InitManager.cpp +++ b/InitManager.cpp @@ -111,3 +111,7 @@ InitManager_Mix::~InitManager_Mix() Mix_Quit(); } +InitManager_SDL* syssdl=NULL; +InitManager_IMG* sysimg=NULL; +InitManager_TTF* systtf=NULL; +InitManager_Mix* sysmix=NULL; diff --git a/InitManager.h b/InitManager.h index 85eeb3d..0ba88d6 100644 --- a/InitManager.h +++ b/InitManager.h @@ -37,7 +37,7 @@ public: ~InitManager_Mix(); }; -extern InitManager_SDL syssdl; -extern InitManager_IMG sysimg; -extern InitManager_TTF systtf; -extern InitManager_Mix sysmix; +extern InitManager_SDL* syssdl; +extern InitManager_IMG* sysimg; +extern InitManager_TTF* systtf; +extern InitManager_Mix* sysmix; diff --git a/basic_config.h b/basic_config.h index d2b0ebb..0e897ad 100644 --- a/basic_config.h +++ b/basic_config.h @@ -1,5 +1,9 @@ #pragma once +#ifdef __C4DROID__ +#define _WINDOW_PROGRAM +#endif // __C4DROID__ + #include #include #include diff --git a/main.cpp b/main.cpp index f2d14ad..6361138 100644 --- a/main.cpp +++ b/main.cpp @@ -1,17 +1,13 @@ #include "config.h" #include "App.h" -InitManager_SDL syssdl; -InitManager_IMG sysimg; -InitManager_TTF systtf; -InitManager_Mix sysmix; - int main() { - mlog_init(); + AllInit(); /// Create The Default Window Instance WindowManager::getDefaultInstance(); App::Main(); WindowManager::releaseDefaultInstance(); + AllQuit(); return 0; } diff --git a/mini_engine.cpp b/mini_engine.cpp index d43cc19..b6937ed 100644 --- a/mini_engine.cpp +++ b/mini_engine.cpp @@ -1 +1,20 @@ #include "mini_engine.h" + +void AllInit() +{ + mlog_init(); + + syssdl=new InitManager_SDL; + sysimg=new InitManager_IMG; + systtf=new InitManager_TTF; + sysmix=new InitManager_Mix; + +} + +void AllQuit() +{ + delete sysmix; + delete systtf; + delete sysimg; + delete syssdl; +} diff --git a/mini_engine.h b/mini_engine.h index 0efecbd..21d1e6e 100644 --- a/mini_engine.h +++ b/mini_engine.h @@ -12,3 +12,6 @@ /******************************************************************************/ /// Application #include "App.h" + +void AllInit(); +void AllQuit();