Files
itgmania212121/stepmania/src/Banner.cpp
T

97 lines
2.7 KiB
C++
Raw Normal View History

2001-11-03 10:52:42 +00:00
#include "stdafx.h"
/*
-----------------------------------------------------------------------------
File: Banner.h
2001-11-03 10:52:42 +00:00
Desc: The song's banner displayed in SelectSong.
2001-11-03 10:52:42 +00:00
2002-05-19 01:59:48 +00:00
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
-----------------------------------------------------------------------------
*/
2001-11-03 10:52:42 +00:00
#include "RageUtil.h"
#include "Banner.h"
2002-07-23 01:41:40 +00:00
#include "PrefsManager.h"
2002-05-19 01:59:48 +00:00
#include "SongManager.h"
#include "RageBitmapTexture.h"
2001-11-03 10:52:42 +00:00
2002-05-19 01:59:48 +00:00
bool Banner::Load( CString sFilePath, bool bForceReload, int iMipMaps, int iAlphaBits, bool bDither, bool bStretch )
{
// note that the defaults are changes for faster loading
return CroppedSprite::Load( sFilePath, bForceReload, iMipMaps, iAlphaBits, bDither, bStretch );
};
void Banner::Update( float fDeltaTime )
{
CroppedSprite::Update( fDeltaTime );
if( m_bScrolling )
{
m_fPercentScrolling += fDeltaTime/2;
m_fPercentScrolling -= (int)m_fPercentScrolling;
2002-05-27 08:23:27 +00:00
FRECT* pTextureRect = m_pTexture->GetTextureCoordRect(0);
2002-05-19 01:59:48 +00:00
float fTexCoords[8] =
{
2002-05-27 08:23:27 +00:00
0+m_fPercentScrolling, pTextureRect->bottom, // bottom left
0+m_fPercentScrolling, pTextureRect->top, // top left
1+m_fPercentScrolling, pTextureRect->bottom, // bottom right
1+m_fPercentScrolling, pTextureRect->top, // top right
2002-05-19 01:59:48 +00:00
};
Sprite::SetCustomTextureCoords( fTexCoords );
}
}
2001-12-28 10:15:59 +00:00
2002-01-29 21:56:14 +00:00
bool Banner::LoadFromSong( Song* pSong ) // NULL means no song
2001-11-03 10:52:42 +00:00
{
2002-05-27 08:23:27 +00:00
m_bScrolling = false;
2002-05-19 01:59:48 +00:00
2002-03-31 07:55:25 +00:00
Sprite::TurnShadowOff();
if( pSong == NULL ) Banner::Load( THEME->GetPathTo("Graphics","fallback banner") );
2002-05-19 01:59:48 +00:00
else if( pSong->HasBanner() ) Banner::Load( pSong->GetBannerPath() );
2002-07-11 19:02:26 +00:00
// else if( pSong->HasBackground() ) Banner::Load( pSong->GetBackgroundPath() );
else Banner::Load( THEME->GetPathTo("Graphics","fallback banner") );
2002-05-19 01:59:48 +00:00
return true;
}
bool Banner::LoadFromGroup( CString sGroupName )
{
2002-07-02 00:27:58 +00:00
m_bScrolling = false;
2002-05-19 01:59:48 +00:00
CString sGroupBannerPath = SONGMAN->GetGroupBannerPath( sGroupName );
if( sGroupName == "ALL MUSIC" )
Banner::Load( THEME->GetPathTo("Graphics","all music banner") );
else if( sGroupBannerPath != "" )
2002-05-19 01:59:48 +00:00
Banner::Load( sGroupBannerPath );
else
Banner::Load( THEME->GetPathTo("Graphics","select music section banner") );
2002-01-16 10:01:32 +00:00
2002-03-06 08:25:09 +00:00
return true;
}
2002-06-14 22:25:22 +00:00
bool Banner::LoadFromCourse( Course* pCourse ) // NULL means no course
{
m_bScrolling = false;
Sprite::TurnShadowOff();
if( pCourse == NULL ) Banner::Load( THEME->GetPathTo("Graphics","fallback banner") );
2002-06-14 22:25:22 +00:00
else if( pCourse->m_sBannerPath != "" ) Banner::Load( pCourse->m_sBannerPath );
else Banner::Load( THEME->GetPathTo("Graphics","fallback banner") );
2002-06-14 22:25:22 +00:00
return true;
}
2002-05-19 01:59:48 +00:00
bool Banner::LoadRoulette()
{
Banner::Load( THEME->GetPathTo("Graphics","select music roulette banner"), false, 0, 0, false, false );
2002-05-19 01:59:48 +00:00
m_bScrolling = true;
2002-05-27 08:23:27 +00:00
return true;
2002-05-19 01:59:48 +00:00
}