void EditorConfig::LoadConfigs() { LoadGlobalConfig(); LoadProjectConfig(); mConfigsLoaded = true; }
//-------------------------------------------------------------------- int CFKCocos2dxAppWrapper::Run() { bool bRet = 0; // first ,load project config LoadProjectConfig(); // create consle HWND hwndConsole = NULL; if (m_tagAppConfig.IsShowConsole()) { AllocConsole(); freopen("CONOUT$", "wt", stdout); freopen("CONOUT$", "wt", stderr); // disable close console hwndConsole = GetConsoleWindow(); if (hwndConsole != NULL) { HMENU hMenu = GetSystemMenu(hwndConsole, FALSE); if (hMenu != NULL) DeleteMenu(hMenu, SC_CLOSE, MF_BYCOMMAND); ShowWindow(hwndConsole, SW_SHOW); BringWindowToTop(hwndConsole); } } // create log file if (m_tagAppConfig.IsWriteDebugLogToFile()) { const string debugLogFilePath = m_tagAppConfig.GetDebugLogFilePath(); m_pWriteDebugLogFile = fopen(debugLogFilePath.c_str(), "w"); if ( m_pWriteDebugLogFile == NULL ) { FKLOG("Cannot create debug log file %s", debugLogFilePath.c_str()); } } // MainLoop do { m_bIsExit = TRUE; // create app m_pApp = new AppDelegate(); if( m_pApp == NULL ) { bRet = false; break; } // set some environments m_pApp->SetProjectConfig( m_tagAppConfig ); CCFileUtils::sharedFileUtils()->addSearchPath( m_tagAppConfig.GetProjectDir().c_str() ); // create openGL view CCEGLView* eglView = CCEGLView::sharedOpenGLView(); eglView->setMenuResource(MAKEINTRESOURCE(IDC_LUAHOSTWIN32)); eglView->setWndProc (WindowProc ); eglView->setFrameSize( m_tagAppConfig.GetFrameSize().width, m_tagAppConfig.GetFrameSize().height ); eglView->setFrameZoomFactor( m_tagAppConfig.GetFrameScale() ); // set window actived m_hWnd = eglView->getHWnd(); BringWindowToTop(m_hWnd); SetWindowTextA(m_hWnd, "FKCocos2dxAppWrapper Project"); // center window position eglView->centerWindow(); // set icon HICON icon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_LUAHOSTWIN32)); SendMessage( m_hWnd, WM_SETICON, ICON_BIG, (LPARAM)icon); if (hwndConsole) { SendMessage(hwndConsole, WM_SETICON, ICON_BIG, (LPARAM)icon); } // set menu CreateViewMenu(); UpdateViewMenu(); // run games m_pApp->run(); // clean up CocosDenshion::SimpleAudioEngine::end(); delete m_pApp; m_pApp = NULL; }while( !m_bIsExit ); // ready exit FreeConsole(); if( m_pWriteDebugLogFile != NULL ) { fclose(m_pWriteDebugLogFile); } return bRet; }