//-------------------------------------------------------------------- void CFKCocos2dxAppWrapper::OnResumeGame() { if( CCDirector::sharedDirector()->isPaused() ) { CCDirector::sharedDirector()->resume(); } UpdateViewMenu(); }
void UpdateAllMenus(anime::Item* anime_item) { UpdateAnimeMenu(anime_item); UpdateAnnounceMenu(); UpdateExternalLinksMenu(); UpdateFoldersMenu(); UpdateToolsMenu(); UpdateTrayMenu(); UpdateViewMenu(); }
//-------------------------------------------------------------------- void CFKCocos2dxAppWrapper::OnChangeSpeed( float p_fValue ) { if( p_fValue == 4.0f || p_fValue == 2.0f || p_fValue == 1.0f || p_fValue == 0.5f || p_fValue == 0.25f ) { m_fCurSpeed = p_fValue; CCDirector::sharedDirector()->getScheduler()->setTimeScale(m_fCurSpeed); UpdateViewMenu(); } }
//-------------------------------------------------------------------- void CFKCocos2dxAppWrapper::OnReduceSpeed() { if( m_fCurSpeed > 0.25f ) { m_fCurSpeed /= 2; } CCDirector::sharedDirector()->getScheduler()->setTimeScale(m_fCurSpeed); UpdateViewMenu(); }
//-------------------------------------------------------------------- void CFKCocos2dxAppWrapper::OnIncreaseSpeed() { if( m_fCurSpeed < 4.0f ) { m_fCurSpeed *= 2; } CCDirector::sharedDirector()->getScheduler()->setTimeScale(m_fCurSpeed); UpdateViewMenu(); }
//-------------------------------------------------------------------- void CFKCocos2dxAppWrapper::OnViewChangeZoom( int p_nScaleMode ) { float scale = 1.0f; if (p_nScaleMode == ID_VIEW_ZOOM_OUT) { scale = 0.5f; } m_tagAppConfig.SetFrameScale(scale); CCEGLView::sharedOpenGLView()->setFrameZoomFactor(scale); CCEGLView::sharedOpenGLView()->resize(m_tagAppConfig.GetFrameSize().width * scale, m_tagAppConfig.GetFrameSize().height * scale); UpdateViewMenu(); }
static BOOL InitMainWnd(PMAIN_WND_INFO Info) { HANDLE DevEnumThread; HMENU hMenu; if (!pCreateToolbar(Info)) DisplayString(_T("error creating toolbar")); if (!CreateTreeView(Info)) { DisplayString(_T("error creating list view")); return FALSE; } if (!CreateStatusBar(Info)) DisplayString(_T("error creating status bar")); UpdateViewMenu(Info); /* make 'properties' bold */ hMenu = GetMenu(Info->hMainWnd); hMenu = GetSubMenu(hMenu, 1); SetMenuDefaultItem(hMenu, IDC_PROP, FALSE); /* Create Popup Menu */ Info->hShortcutMenu = LoadMenu(hInstance, MAKEINTRESOURCE(IDR_POPUP)); Info->hShortcutMenu = GetSubMenu(Info->hShortcutMenu, 0); SetMenuDefaultItem(Info->hShortcutMenu, IDC_PROP, FALSE); /* create seperate thread to emum devices */ DevEnumThread = CreateThread(NULL, 0, DeviceEnumThread, Info, 0, NULL); if (!DevEnumThread) { DisplayString(_T("Failed to enumerate devices")); return FALSE; } CloseHandle(DevEnumThread); return TRUE; }
static VOID MainWndCommand(PMAIN_WND_INFO Info, WORD CmdId, HWND hControl) { UNREFERENCED_PARAMETER(hControl); switch (CmdId) { case IDC_PROP: { HTREEITEM hSelected = TreeView_GetSelection(Info->hTreeView); OpenPropSheet(Info->hTreeView, hSelected); } break; case IDC_REFRESH: { OnRefresh(Info); } break; case IDC_PROGHELP: { DisplayString(_T("Help is not yet implemented\n")); SetFocus(Info->hTreeView); } break; case IDC_EXIT: { PostMessage(Info->hMainWnd, WM_CLOSE, 0, 0); } break; case IDC_ABOUT: { DialogBox(hInstance, MAKEINTRESOURCE(IDD_ABOUTBOX), Info->hMainWnd, AboutDialogProc); SetFocus(Info->hTreeView); } break; case IDC_DEVBYTYPE: { Info->Display = DevicesByType; UpdateViewMenu(Info); OnRefresh(Info); } break; case IDC_DEVBYCONN: { Info->Display = DevicesByConnection; UpdateViewMenu(Info); OnRefresh(Info); } break; case IDC_SHOWHIDDEN: { Info->bShowHidden = !Info->bShowHidden; UpdateViewMenu(Info); OnRefresh(Info); } break; } }
//-------------------------------------------------------------------- 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; }