use RageColor::FromString

This commit is contained in:
Glenn Maynard
2003-11-18 04:06:39 +00:00
parent 8ac946be70
commit 1257380840
+4 -17
View File
@@ -478,23 +478,10 @@ bool ThemeManager::GetMetricB( CString sClassName, CString sValueName )
RageColor ThemeManager::GetMetricC( CString sClassName, CString sValueName )
{
float r=1,b=1,g=1,a=1;
CString sValue = GetMetricRaw(sClassName,sValueName);
int result = sscanf( GetMetricRaw(sClassName,sValueName), "%f,%f,%f,%f", &r, &g, &b, &a );
if( result == 4 )
return RageColor(r,g,b,a);
int ir=255,ib=255,ig=255,ia=255;
result = sscanf( GetMetricRaw(sClassName,sValueName), "#%2x%2x%2x%2x", &ir, &ig, &ib, &ia );
if( result == 4 )
return RageColor(ir / 255.0f, ig / 255.0f, ib / 255.0f, ia / 255.0f);
result = sscanf( GetMetricRaw(sClassName,sValueName), "#%2x%2x%2x", &ir, &ig, &ib );
if( result == 3 )
return RageColor(ir / 255.0f, ig / 255.0f, ib / 255.0f, 1);
LOG->Warn( "The color value '%s' for NoteSkin metric '%s : %s' is invalid.", GetMetricRaw(sClassName,sValueName).c_str(), sClassName.c_str(), sValueName.c_str() );
return RageColor(1,1,1,1);
RageColor ret(1,1,1,1);
if( !ret.FromString( GetMetricRaw(sClassName,sValueName) ) )
LOG->Warn( "The color value '%s' for NoteSkin metric '%s : %s' is invalid.", GetMetricRaw(sClassName,sValueName).c_str(), sClassName.c_str(), sValueName.c_str() );
return ret;
}
void ThemeManager::NextTheme()