void CHumanInterface::OnAnimate (void) // OnAnimate // // Paint an animation frame { if (m_pCurSession) { bool bCrash = false; try { m_pCurSession->HIAnimate(GetScreen()); } catch (...) { bCrash = true; } // If we crashed, report it if (bCrash) HardCrash(CONSTLIT("animating")); } else { GetScreen().Fill(0, 0, GetScreen().GetWidth(), GetScreen().GetHeight(), CG16bitImage::RGBValue(0, 0, 0)); BltScreen(); FlipScreen(); } }
void CHumanInterface::OnAnimate (void) // OnAnimate // // Paint an animation frame { int i; // If minimized, bail out if (m_ScreenMgr.IsMinimized()) return; // DirectDraw if (!m_ScreenMgr.CheckIsReady()) return; // Paint the current session if (m_pCurSession) { bool bCrash = false; try { // Paint the background sessions for (i = 0; i < m_BackgroundSessions.GetCount(); i++) m_BackgroundSessions[i]->HIAnimate(GetScreen(), false); // Paint the current session m_pCurSession->HIAnimate(GetScreen(), true); } catch (...) { bCrash = true; } // If we crashed, report it if (bCrash) HardCrash(CONSTLIT("OnAnimate")); } else { GetScreen().Fill(0, 0, GetScreen().GetWidth(), GetScreen().GetHeight(), CG16bitImage::RGBValue(0, 0, 0)); BltScreen(); FlipScreen(); } }
void CHumanInterface::EndSessionPaint (CG16bitImage &Screen) // EndSessionPatin // // Called in DefaultOnAnimate { // Paint frame rate if (m_bDebugVideo) { m_FrameRate.MarkFrame(); PaintFrameRate(); } // Blt BltScreen(); }
void CHumanInterface::EndSessionPaint (CG16bitImage &Screen, bool bTopMost) // EndSessionPatin // // Called in DefaultOnAnimate { // If this is the top-most session, then do some housekeeping if (bTopMost) { // Paint frame rate if (m_Options.m_bDebugVideo) { m_FrameRate.MarkFrame(); PaintFrameRate(); } // Blt BltScreen(); } }
void CTranscendenceWnd::AnimateIntro (void) // AnimateIntro // // Paint intro screen { DWORD dwStartTimer; if (m_Options.bDebugVideo) dwStartTimer = SDL_GetTicks(); // Tell the universe to paint m_Universe.PaintPOV(m_Screen, m_rcIntroMain, false); // Paint displays m_HighScoreDisplay.Paint(m_Screen); m_PlayerDisplay.Update(); m_PlayerDisplay.Paint(m_Screen); m_ButtonBarDisplay.Update(); m_ButtonBarDisplay.Paint(m_Screen); // Paint version int cy; int cx = m_Fonts.MediumHeavyBold.MeasureText(m_sVersion, &cy); int cxRightMargin = cy; int x = m_rcIntroMain.right - (cx + cxRightMargin); int y = m_rcIntroMain.bottom - (3 * cy); m_Screen.DrawText(x, y, m_Fonts.MediumHeavyBold, RGB_VERSION_COLOR, m_sVersion); y += cy; cx = m_Fonts.Medium.MeasureText(m_sCopyright, &cy); x = m_rcIntroMain.right - (cx + cxRightMargin); m_Screen.DrawText(x, y, m_Fonts.Medium, RGB_COPYRIGHT_COLOR, m_sCopyright); // If we've got a dialog box up, paint it if (m_bOverwriteGameDlg) PaintOverwriteGameDlg(); // Figure out how long it took to paint if (m_Options.bDebugVideo) { DWORD dwNow = SDL_GetTicks(); m_iPaintTime[m_iFrameCount % FRAME_RATE_COUNT] = dwNow - dwStartTimer; dwStartTimer = dwNow; } // Debug information if (m_Options.bDebugVideo) PaintFrameRate(); #ifdef DEBUG PaintDebugLines(); #endif // Update the screen BltScreen(); // Figure out how long it took to blt if (m_Options.bDebugVideo) { DWORD dwNow = SDL_GetTicks(); m_iBltTime[m_iFrameCount % FRAME_RATE_COUNT] = dwNow - dwStartTimer; dwStartTimer = dwNow; } // If the same ship has been here for a while, then create a new ship if (m_iTick - m_iLastShipCreated > MAX_TIME_WITH_ONE_SHIP) { CShip *pShip = m_Universe.GetPOV()->AsShip(); if (pShip) pShip->Destroy(removedFromSystem, NULL); } // Update the universe m_Universe.Update(g_SecondsPerUpdate); m_iTick++; // Figure out how long it took to update if (m_Options.bDebugVideo) { DWORD dwNow = SDL_GetTicks(); m_iUpdateTime[m_iFrameCount % FRAME_RATE_COUNT] = dwNow - dwStartTimer; dwStartTimer = dwNow; } }