bool gkGameFramework::DestroyGameImmediate() { if (m_pGame) { m_pGame->OnDestroy(); m_pGame = NULL; } #ifndef _STATIC_LIB // if (m_pFuncGameEnd) // { // m_pFuncGameEnd(); // m_pFuncGameEnd = NULL; // } #else //gkFreeStaticModule_gkGame(); #endif if(m_hHandleGame) { gkFreeModule(m_hHandleGame); m_hHandleGame = 0; } return true; }
//-------------------------------------------------------------------------------------- // Initialize everything and go into a render loop //-------------------------------------------------------------------------------------- INT WINAPI wWinMain( HINSTANCE, HINSTANCE, LPWSTR, int ) { // Enable run-time memory check for debug builds. #if (defined(DEBUG) || defined(_DEBUG)) && defined( OS_WIN32 ) _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); #endif #ifdef _STATIC_LIB IGameFramework* game = gkLoadStaticModule_gkGameFramework(); #else // load gkSystem dll HINSTANCE hHandle = 0; gkOpenModule(hHandle, _T("gkGameFramework"));//, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); GET_SYSTEM pFuncStart = (GET_SYSTEM)DLL_GETSYM(hHandle, "gkModuleInitialize"); IGameFramework* game = pFuncStart(); #endif int width = 1280; int height = 720; // init ISystemInitInfo sii; sii.fWidth = width; sii.fHeight = height; if (!(game->Init(sii))) { return 0; } game->PostInit( NULL, sii ); game->InitGame( NULL ); // run game->Run(); // destroy game->DestroyGame(false); game->Destroy(); // free #ifdef _STATIC_LIB gkFreeStaticModule_gkGameFramework(); #else gkFreeModule( hHandle ); #endif return 0; }