Files
itgmania212121/stepmania/src/Banner.cpp
T

82 lines
2.2 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-01-16 10:01:32 +00:00
#include "ThemeManager.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();
2002-05-19 01:59:48 +00:00
if( pSong == NULL ) Banner::Load( THEME->GetPathTo(GRAPHIC_FALLBACK_BANNER) );
else if( pSong->HasBanner() ) Banner::Load( pSong->GetBannerPath() );
else if( pSong->HasBackground() ) Banner::Load( pSong->GetBackgroundPath() );
else Banner::Load( THEME->GetPathTo(GRAPHIC_FALLBACK_BANNER) );
return true;
}
bool Banner::LoadFromGroup( CString sGroupName )
{
2002-05-27 08:23:27 +00:00
m_bScrolling = true;
2002-05-19 01:59:48 +00:00
CString sGroupBannerPath = SONGMAN->GetGroupBannerPath( sGroupName );
2002-05-27 08:23:27 +00:00
if( sGroupBannerPath != "" )
2002-05-19 01:59:48 +00:00
Banner::Load( sGroupBannerPath );
else
2002-05-27 08:23:27 +00:00
Banner::Load( THEME->GetPathTo(GRAPHIC_SELECT_MUSIC_SECTION_BANNER) );
2002-01-16 10:01:32 +00:00
2002-03-06 08:25:09 +00:00
return true;
}
2002-05-19 01:59:48 +00:00
bool Banner::LoadRoulette()
{
2002-05-27 08:23:27 +00:00
Banner::Load( THEME->GetPathTo(GRAPHIC_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
}