コード例 #1
0
ファイル: IntroScreen.cpp プロジェクト: alanhorizon/Transport
void CTranscendenceWnd::OnCharIntro (char chChar, DWORD dwKeyData)

//	OnCharIntro
//
//	Handle WM_CHAR

	{
	if (m_bOverwriteGameDlg)
		{
		return;
		}

	if (m_PlayerDisplay.OnChar(chChar))
		return;

	if (m_ButtonBarDisplay.OnChar(chChar))
		return;

	switch (chChar)
		{
		case 'N':
		case 'n':
			{
			CShip *pShip = m_Universe.GetPOV()->AsShip();
			if (pShip)
				{
				m_dwIntroShipClass = pShip->GetClass()->GetUNID();

				pShip->Destroy(removedFromSystem, NULL);
				}
			break;
			}
		}
	}
コード例 #2
0
ファイル: IntroScreen.cpp プロジェクト: alanhorizon/Transport
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;
		}
	}