//----------------------------------------------------------------------------- // Name : BeginGame () // Desc : Signals the beginning of the physical post-initialisation stage. // From here on, the game engine has control over processing. //----------------------------------------------------------------------------- int CDDGameApp::BeginGame() { MSG msg; // Start main loop while (1) { // Did we recieve a message, or are we idling ? if ( PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) ) { if (msg.message == WM_QUIT) break; TranslateMessage( &msg ); DispatchMessage ( &msg ); } else { // Advance Game Frame. FrameAdvance(); } // End If messages waiting } // Until quit message is receieved return 0; }
void MenuBar::AddEmulationMenu() { QMenu* emu_menu = addMenu(tr("Emulation")); m_play_action = emu_menu->addAction(tr("Play"), this, SIGNAL(Play())); m_pause_action = emu_menu->addAction(tr("Pause"), this, SIGNAL(Pause())); m_stop_action = emu_menu->addAction(tr("Stop"), this, SIGNAL(Stop())); m_reset_action = emu_menu->addAction(tr("Reset"), this, SIGNAL(Reset())); m_fullscreen_action = emu_menu->addAction(tr("Fullscreen"), this, SIGNAL(Fullscreen())); m_frame_advance_action = emu_menu->addAction(tr("Frame Advance"), this, SIGNAL(FrameAdvance())); m_screenshot_action = emu_menu->addAction(tr("Take Screenshot"), this, SIGNAL(Screenshot())); AddStateLoadMenu(emu_menu); AddStateSaveMenu(emu_menu); AddStateSlotMenu(emu_menu); UpdateStateSlotMenu(); }
void CEngine::Main() { InitFormat(); QtInterface window; m_pWindow = &window; window.resize(1024, 578); window.show(); window.raise(); // Bring to front Script()->PostInit(); while ( !window.shouldClose() ) { m_pApp->processEvents(); FrameAdvance(); if ( Input()->KeyPressed( KEY_ESC ) ) { break; } else if (Input()->KeyHeld( KEY_ALT ) && ( Input()->KeyReleased( KEY_ENTER ) || Input()->KeyReleased( KEY_RETURN ) ) ) { if ( window.isFullScreen() ) { window.showNormal(); } else { window.showFullScreen(); } } window.Render(); for (int i = 0; i < m_vecGameSystems.size(); i++) { m_vecGameSystems[i]->PostRender(); } // We don't really need more than 100 fps, so sleep for 0.01 sec msleep(0); } Message("Engine Main End\n"); }
void HK_FrameAdvanceKeyUp(int) { FrameAdvance(false); }
void HK_FrameAdvanceKeyDown(int, bool justPressed) { FrameAdvance(true); }
//----------------------------------------------------------------------------- // Name : BeginGame () // Desc : Signals the beginning of the physical post-initialization stage. // From here on, the game engine has control over processing. //----------------------------------------------------------------------------- int CGameApp::BeginGame() { MSG msg; StartGame = false; // Start main loop while(true) { // Did we receive a message, or are we idling ? if ( PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) ) { if (msg.message == WM_QUIT) break; TranslateMessage( &msg ); DispatchMessage ( &msg ); } else { cursor.cbSize = sizeof(CURSORINFO); GetCursorInfo(&cursor); // Advance Game Frame. if(StartGame == false) { if(cursor.ptScreenPos.x > m_nViewWidth - LOCATE_MENU_X && cursor.ptScreenPos.y < LOCATE_MENU_Y_TOP) { if (!BuildObjects()) { MessageBox( 0, _T("Failed to initialize properly. Reinstalling the application may solve this problem.\nIf the problem persists, please contact technical support."), _T("Fatal Error"), MB_OK | MB_ICONSTOP); ShutDown(); return false; } // Set up all required game states SetupGameState(); StartGame = true; } if(StartLoad == true) { if (!BuildObjects_Load()) { MessageBox( 0, _T("Failed to initialize properly. Reinstalling the application may solve this problem.\nIf the problem persists, please contact technical support."), _T("Fatal Error"), MB_OK | MB_ICONSTOP); ShutDown(); return false; } // Set up all required game states SetupGameState(); StartGame = true; } if(cursor.ptScreenPos.x > m_nViewWidth - LOCATE_MENU_X && cursor.ptScreenPos.y > m_nViewHeight + LOCATE_MENU_Y_BOTTOM) { PostQuitMessage(0); } } FrameAdvance(); } // End If messages waiting } // Until quit message is received return 0; }
//------------------------------------------------------ // Name: BeginGame() // Desc: Do init here, calls frame advance. //------------------------------------------------------ int CTetris::BeginGame( ) { while(!m_bExit) FrameAdvance( ); return 1; }