//---------------------------------------------------- //---------------------------------------------------- void Application::Update(f32 in_deltaTime, TimeIntervalSecs in_timestamp) { if(m_shouldNotifyConnectionsResumeEvent == true) { m_shouldNotifyConnectionsResumeEvent = false; OnResume(); } if(m_shouldNotifyConnectionsForegroundEvent == true) { m_shouldNotifyConnectionsForegroundEvent = false; OnForeground(); } if(m_isSuspending) { // Updating after told to suspend so early out return; } #if CS_ENABLE_DEBUG //When debugging we may have breakpoints so restrict the time between //updates to something feasible. in_deltaTime = std::min(in_deltaTime, 0.5f); #endif //Update the app time since start m_currentAppTime = in_timestamp; m_taskScheduler->ExecuteMainThreadTasks(); //We do not need to render as often as we update so this callback will be triggered //less freqenctly than the update frequency suggests. We must work out how many times to update based on the time since last frame //and our actual update frequency. We carry the remainder to the next frame until we have a full update cycle m_updateIntervalRemainder = std::min(m_updateIntervalRemainder + in_deltaTime, GetUpdateIntervalMax()); //process any queued input received by the pointer system. if(m_pointerSystem != nullptr) { m_pointerSystem->ProcessQueuedInput(); } while((m_updateIntervalRemainder >= GetUpdateInterval()) || m_isFirstFrame) { m_updateIntervalRemainder -= GetUpdateInterval(); //update all of the application systems for (const AppSystemUPtr& system : m_systems) { system->OnFixedUpdate(GetUpdateInterval()); } m_stateManager->FixedUpdateStates(GetUpdateInterval()); m_isFirstFrame = false; } //Tell the state manager to update the active state OnUpdate(in_deltaTime); }
//----------------------------------------- //----------------------------------------- void State::Resume() { u32 numSystems = m_systems.size(); for(u32 i=0; i<numSystems; ++i) { m_systems[i]->OnResume(); } m_scene->ResumeEntities(); OnResume(); }
LRESULT GameBase::MessageHandler( UINT msg, WPARAM wparam, LPARAM lparam ) { switch (msg) { case WM_CLOSE: DestroyWindow( m_hwnd ); break; case WM_DESTROY: OnShutdown(); PostQuitMessage(0); break; case WM_KEYDOWN: if (!(lparam & 0x40000000)) // Prevent auto-repeat { OnKeyDown( wparam ); } break; case WM_KEYUP: OnKeyUp( wparam ); break; case WM_LBUTTONDOWN: OnStylusDown( Point( LOWORD(lparam), HIWORD(lparam) ) ); break; case WM_LBUTTONUP: OnStylusUp( Point( LOWORD(lparam), HIWORD(lparam) ) ); break; case WM_MOUSEMOVE: OnStylusMove( Point( LOWORD(lparam), HIWORD(lparam) ) ); break; case WM_ACTIVATE: if (LOWORD(wparam) == WA_INACTIVE) { m_bSuspended = true; OnSuspend(); } else { m_bSuspended = false; OnResume(); } break; } return DefWindowProc( m_hwnd, msg, wparam, lparam ); }
void App::Resume() { if (mPause) { d_printf("---: Reset device..."); mRenderSystem->OnResetDevice(); OnResume(); mPause = false; } }
BOOL CBaseScreen::OnWndProc(void* /*pi*/, AEEEvent eCode , uint16 wParam , uint32 dwParam) // 窗口主消息处理函数 { BOOL bRet = FALSE; switch (eCode) { case EVT_KEY_PRESS: { bRet = OnKeyPressed(wParam); } break; case EVT_KEY_RELEASE: { bRet = OnKeyReleased(wParam); } break; case EVT_KEY_HELD: { //注意这条消息没有处理 } break; case EVT_APP_SUSPEND: { bRet = OnSuspend(); } break; case EVT_APP_RESUME: { bRet = OnResume(); } break; case EVT_EXT_PEN_PRESS: { bRet = OnPointerPressed((int)wParam, (int)dwParam); } break; case EVT_EXT_PEN: { bRet = OnPointerDragged((int)wParam, (int)dwParam); } break; case EVT_EXT_PEN_RELEASE: { bRet = OnPointerReleased((int)wParam, (int)dwParam); } break; default: break; } return bRet; }
void Application::Resume() { OnResume(); }