Beispiel #1
0
void ScreenUserPacks::Init()
{
	ScreenWithMenuElements::Init();

	if ( USER_PACK_WAIT_TEXT.GetValue().empty() )
		USER_PACK_WAIT_TEXT.SetValue("Please Wait...");

	if ( USER_PACK_CANCEL_TEXT.GetValue().empty() )
	{
		USER_PACK_CANCEL_TEXT.SetValue(ssprintf( "Pressing %s will cancel this selection.",
			DiagnosticsUtil::GetInputType() == "ITGIO" ? "&MENULEFT;+&MENURIGHT;" : "&SELECT;" ));
	}

	m_SoundDelete.Load( THEME->GetPathS( m_sName, "delete" ) );
	m_SoundTransferDone.Load( THEME->GetPathS( m_sName, "transfer done" ) );

	m_AddedZips.SetName( "LinkedOptionsMenuAddedZips" );
	m_USBZips.SetName( "LinkedOptionsMenuUSBZips" );
	m_Exit.SetName( "LinkedOptionsMenuSASExit" );

	m_USBZips.Load( NULL, &m_AddedZips );
	m_AddedZips.Load( &m_USBZips, &m_Exit );
	m_Exit.Load( &m_AddedZips, NULL );

	m_USBZips.SetMenuChangeScreenMessage( SM_LinkedMenuChange );
	m_AddedZips.SetMenuChangeScreenMessage( SM_LinkedMenuChange );
	m_Exit.SetMenuChangeScreenMessage( SM_LinkedMenuChange ); // why not..

	this->AddChild( &m_AddedZips );
	this->AddChild( &m_USBZips );
	this->AddChild( &m_Exit );

	SET_XY_AND_ON_COMMAND( m_AddedZips );
	SET_XY_AND_ON_COMMAND( m_USBZips );
	SET_XY_AND_ON_COMMAND( m_Exit );

	m_Disclaimer.SetName( "Disclaimer" );
	m_Disclaimer.LoadFromFont( THEME->GetPathF( m_sName, "text" ) );
	m_Disclaimer.SetText( THEME->GetMetric(m_sName, "DisclaimerText") );
	SET_XY_AND_ON_COMMAND( m_Disclaimer );
	this->AddChild( &m_Disclaimer );

	this->SortByDrawOrder();

	{
		CStringArray asExit;
		asExit.push_back( "Exit" );
		m_Exit.SetChoices( asExit );
	}

	m_Exit.Focus();
	m_pCurLOM = &m_Exit;
	
	m_bStopThread = false;
	m_PlayerSongLoadThread.SetName( "Song Add Thread" );
	m_PlayerSongLoadThread.Create( InitSASSongThread, this );

	ReloadZips();
}
Beispiel #2
0
void LyricDisplay::Update( float fDeltaTime )
{
	ActorFrame::Update( fDeltaTime );

	if( GAMESTATE->m_pCurSong == NULL )
		return;

	/* If the song has changed (in a course), reset. */
	if( GAMESTATE->m_fMusicSeconds < m_fLastSecond )
		Init();
	m_fLastSecond = GAMESTATE->m_fMusicSeconds;

	if( m_iCurLyricNumber >= GAMESTATE->m_pCurSong->m_LyricSegments.size() )
		return;

	const Song *pSong = GAMESTATE->m_pCurSong;
	const float fStartTime = (pSong->m_LyricSegments[m_iCurLyricNumber].m_fStartTime) - IN_LENGTH.GetValue();

	if( GAMESTATE->m_fMusicSeconds < fStartTime )
		return;

	/* Clamp this lyric to the beginning of the next or the end of the music. */
	float fEndTime;
	if( m_iCurLyricNumber+1 < GAMESTATE->m_pCurSong->m_LyricSegments.size() )
		fEndTime = pSong->m_LyricSegments[m_iCurLyricNumber+1].m_fStartTime;
	else
		fEndTime = pSong->GetElapsedTimeFromBeat( pSong->m_fLastBeat );

	const float fDistance = fEndTime - pSong->m_LyricSegments[m_iCurLyricNumber].m_fStartTime;
	const float fTweenBufferTime = IN_LENGTH.GetValue() + OUT_LENGTH.GetValue();

	/* If it's negative, two lyrics are so close together that there's no time
	 * to tween properly.  Lyrics should never be this brief, anyway, so just
	 * skip it. */
	float fShowLength = max( fDistance - fTweenBufferTime, 0.0f );

	// Make lyrics show faster for faster song rates.
	fShowLength /= GAMESTATE->m_SongOptions.GetCurrent().m_fMusicRate;

	const LyricSegment &seg = GAMESTATE->m_pCurSong->m_LyricSegments[m_iCurLyricNumber];

	LuaThreadVariable var1( "LyricText", seg.m_sLyric );
	LuaThreadVariable var2( "LyricDuration", LuaReference::Create(fShowLength) );
	LuaThreadVariable var3( "LyricColor", LuaReference::Create(seg.m_Color) );

	PlayCommand( "Changed" );

	m_iCurLyricNumber++;
}
void ScreenDimensions::ReloadScreenDimensions()
{
	// Important: explicitly refresh cached metrics that we use.
	THEME_SCREEN_WIDTH.Read();
	THEME_SCREEN_HEIGHT.Read();

	LUA->SetGlobal( "SCREEN_WIDTH", (int) SCREEN_WIDTH );
	LUA->SetGlobal( "SCREEN_HEIGHT", (int) SCREEN_HEIGHT );
	LUA->SetGlobal( "SCREEN_LEFT", (int) SCREEN_LEFT );
	LUA->SetGlobal( "SCREEN_RIGHT", (int) SCREEN_RIGHT );
	LUA->SetGlobal( "SCREEN_TOP", (int) SCREEN_TOP );
	LUA->SetGlobal( "SCREEN_BOTTOM", (int) SCREEN_BOTTOM );
	LUA->SetGlobal( "SCREEN_CENTER_X", (int) SCREEN_CENTER_X );
	LUA->SetGlobal( "SCREEN_CENTER_Y", (int) SCREEN_CENTER_Y );

	LUA->SetGlobal( "ASPECT_SCALE_FACTOR", (int) ASPECT_SCALE_FACTOR );
}
Beispiel #4
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;
}