Files
itgmania212121/stepmania/src/ScreenMusicScroll.cpp
T

101 lines
2.8 KiB
C++
Raw Normal View History

2003-02-16 04:01:45 +00:00
#include "global.h"
2002-05-20 08:59:37 +00:00
/*
-----------------------------------------------------------------------------
Class: ScreenMusicScroll
Desc: See header.
Copyright (c) 2001-2003 by the person(s) listed below. All rights reserved.
2002-05-20 08:59:37 +00:00
Chris Danford
Glenn Maynard
2002-05-20 08:59:37 +00:00
-----------------------------------------------------------------------------
*/
#include "ScreenMusicScroll.h"
#include "SongManager.h"
2003-07-26 23:05:16 +00:00
#include "RageSounds.h"
#include "ThemeManager.h"
#include "AnnouncerManager.h"
2003-11-07 20:24:44 +00:00
#include "song.h"
#include "SongUtil.h"
2002-05-20 08:59:37 +00:00
#define SCROLL_DELAY THEME->GetMetricF("ScreenMusicScroll","ScrollDelay")
#define SCROLL_SPEED THEME->GetMetricF("ScreenMusicScroll","ScrollSpeed")
#define TEXT_ZOOM THEME->GetMetricF("ScreenMusicScroll","TextZoom")
2002-05-20 08:59:37 +00:00
const CString CREDIT_LINES[] =
{
2003-04-03 22:10:40 +00:00
""
2002-05-20 08:59:37 +00:00
};
const unsigned NUM_CREDIT_LINES = sizeof(CREDIT_LINES) / sizeof(CString);
2002-05-20 08:59:37 +00:00
ScreenMusicScroll::ScreenMusicScroll( CString sClassName ) : ScreenAttract( sClassName )
2002-05-20 08:59:37 +00:00
{
vector<Song*> arraySongs;
SONGMAN->GetSongs( arraySongs );
SongUtil::SortSongPointerArrayByTitle( arraySongs );
2002-05-20 08:59:37 +00:00
unsigned i;
2003-05-30 20:39:40 +00:00
for( i=0; i < arraySongs.size(); i++ )
2002-05-20 08:59:37 +00:00
{
2003-05-30 20:39:40 +00:00
BitmapText *bt = new BitmapText;
m_textLines.push_back(bt);
2002-05-20 08:59:37 +00:00
Song* pSong = arraySongs[i];
2003-05-30 20:39:40 +00:00
bt->LoadFromFont( THEME->GetPathToF("ScreenMusicScroll titles") );
bt->SetText( pSong->GetFullDisplayTitle(), pSong->GetFullTranslitTitle() );
bt->SetDiffuse( SONGMAN->GetSongColor(pSong) );
bt->SetZoom( TEXT_ZOOM );
this->AddChild( bt );
2002-05-20 08:59:37 +00:00
}
2003-04-03 22:10:40 +00:00
// for( i=0; i<min(NUM_CREDIT_LINES, MAX_CREDIT_LINES); i++ )
// {
// m_textLines[m_iNumLines].LoadFromFont( THEME->GetPathToF("ScreenMusicScroll titles") );
2003-04-03 22:10:40 +00:00
// m_textLines[m_iNumLines].SetText( CREDIT_LINES[i] );
// m_textLines[m_iNumLines].SetZoom( TEXT_ZOOM );
//
// m_iNumLines++;
// }
2002-05-20 08:59:37 +00:00
2003-05-30 20:39:40 +00:00
for( i=0; i<m_textLines.size(); i++ )
2002-05-20 08:59:37 +00:00
{
2003-05-30 20:39:40 +00:00
m_textLines[i]->SetXY( CENTER_X, SCREEN_BOTTOM + 40 );
m_textLines[i]->BeginTweening( SCROLL_DELAY * i );
m_textLines[i]->BeginTweening( 2.0f*SCROLL_SPEED );
m_textLines[i]->SetXY( CENTER_X, SCREEN_TOP - 40 );
2002-05-20 08:59:37 +00:00
}
this->MoveToTail( &m_In ); // put it in the back so it covers up the stuff we just added
this->MoveToTail( &m_Out ); // put it in the back so it covers up the stuff we just added
2002-05-20 08:59:37 +00:00
this->ClearMessageQueue( SM_BeginFadingOut ); // ignore ScreenAttract's SecsToShow
this->PostScreenMessage( SM_BeginFadingOut, 0.2f * i + 3.0f );
2002-05-20 08:59:37 +00:00
2003-07-26 23:05:16 +00:00
SOUND->PlayOnceFromDir( ANNOUNCER->GetPathTo("music scroll") );
2002-05-20 08:59:37 +00:00
}
ScreenMusicScroll::~ScreenMusicScroll()
2002-05-20 08:59:37 +00:00
{
2003-05-30 20:39:40 +00:00
for( unsigned i=0; i<m_textLines.size(); i++ )
delete m_textLines[i];
}
2002-05-20 08:59:37 +00:00
void ScreenMusicScroll::Update( float fDeltaTime )
2002-05-20 08:59:37 +00:00
{
ScreenAttract::Update( fDeltaTime );
2002-05-20 08:59:37 +00:00
2003-05-30 20:39:40 +00:00
for( unsigned i=0; i<m_textLines.size(); i++ )
2002-05-20 08:59:37 +00:00
{
const bool shown = ( m_textLines[i]->GetY() > SCREEN_TOP-20 &&
m_textLines[i]->GetY() < SCREEN_BOTTOM+20 );
m_textLines[i]->SetHidden( !shown );
2002-05-20 08:59:37 +00:00
}
}