void ScreenSetTime::MenuStart( PlayerNumber pn )
{
	bool bHoldingLeftAndRight = 
		INPUTMAPPER->IsButtonDown( MenuInput(pn, MENU_BUTTON_RIGHT) ) &&
		INPUTMAPPER->IsButtonDown( MenuInput(pn, MENU_BUTTON_LEFT) );

	if( bHoldingLeftAndRight )
		ChangeSelection( -1 );
	else if( m_Selection == NUM_SET_TIME_SELECTIONS -1 )	// last row
	{
		/* Save the new time. */
		time_t iNow = time(NULL);
		time_t iAdjusted = iNow + m_TimeOffset;

		tm adjusted;
		localtime_r( &iAdjusted, &adjusted );

		HOOKS->SetTime( adjusted );

		/* We're going to draw a little more while we transition out.  We've already
		 * set the new time; don't over-adjust visually. */
		m_TimeOffset = 0;

		SOUND->PlayOnce( THEME->GetPathS("Common","start") );
		StartTransitioning( SM_GoToNextScreen );
	}
	else
		ChangeSelection( +1 );
}
示例#2
0
bool CProfileSelectState::Input()
{
	if (state >= MyState::Menu)
		MenuInput();
	else
		SeletionInput();
	return true;
}
示例#3
0
bool UpdateXferProgress( uint64_t iBytesCurrent, uint64_t iBytesTotal )
{
	bool bInterrupt = false;

	FOREACH_EnabledPlayer(pn)
	{
		bInterrupt |= INPUTMAPPER->IsButtonDown( MenuInput(pn, MENU_BUTTON_SELECT) );

		bInterrupt |= INPUTMAPPER->IsButtonDown(MenuInput(pn, MENU_BUTTON_LEFT)) &&
			INPUTMAPPER->IsButtonDown(MenuInput(pn, MENU_BUTTON_RIGHT));
	}

	if ( bInterrupt )
	{
		InputEventArray throwaway;
		INPUTFILTER->GetInputEvents( throwaway );
		return false;
	}

	// Draw() is very expensive: only do it on occasion.
	if( DrawTimer.Ago() < DRAW_UPDATE_TIME )
		return true;

	/* this truncates to int, but that's okay for our purposes */
	float iTransferRate = iBytesCurrent / g_UpdateDuration.Ago();

	float fPercent = iBytesCurrent / (iBytesTotal/100);

	const CString sRate = FormatByteValue( iTransferRate ) + "/sec";

	CString sMessage = ssprintf( "\n\n%s\n%.2f%% %s\n\n%s",
		USER_PACK_WAIT_TEXT.GetValue().c_str(),
		fPercent,
		sRate.c_str(),
		USER_PACK_CANCEL_TEXT.GetValue().c_str()
	);
	SCREENMAN->OverlayMessage( sMessage );


	SCREENMAN->Draw();
	DrawTimer.Touch();
	return true;
}