Files
itgmania212121/stepmania/src/OptionIcon.cpp
T
Chris Danford 2929bacb08 show per-diffculty award on Eval screen every time it's received (not just the first time)
clean up ScreenEval PR and MR graphics
clean up Actor shadow parameters
2004-03-20 02:59:08 +00:00

74 lines
1.9 KiB
C++

#include "global.h"
/*
-----------------------------------------------------------------------------
Class: OptionIcon
Desc: A graphic displayed in the OptionIcon during Dancing.
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford
-----------------------------------------------------------------------------
*/
#include "OptionIcon.h"
#include "ThemeManager.h"
#include "PlayerOptions.h"
#define TEXT_OFFSET_X THEME->GetMetricF("OptionIcon","TextOffsetX")
#define TEXT_OFFSET_Y THEME->GetMetricF("OptionIcon","TextOffsetY")
#define TEXT_H_ALIGN THEME->GetMetricI("OptionIcon","TextHAlign")
#define TEXT_V_ALIGN THEME->GetMetricI("OptionIcon","TextVAlign")
#define TEXT_WIDTH THEME->GetMetricI("OptionIcon","TextWidth")
#define TEXT_ZOOM THEME->GetMetricF("OptionIcon","TextZoom")
#define UPPERCASE THEME->GetMetricB("OptionIcon","Uppercase")
OptionIcon::OptionIcon()
{
m_spr.Load( THEME->GetPathToG("OptionIcon frame 3x2") );
m_spr.StopAnimating();
this->AddChild( &m_spr );
m_text.LoadFromFont( THEME->GetPathToF("OptionIcon") );
m_text.SetShadowLength( 0 );
m_text.SetZoom( TEXT_ZOOM );
m_text.SetXY( TEXT_OFFSET_X, TEXT_OFFSET_Y );
m_text.SetHorizAlign( (Actor::HorizAlign)TEXT_H_ALIGN );
m_text.SetVertAlign( (Actor::VertAlign)TEXT_V_ALIGN );
this->AddChild( &m_text );
}
void OptionIcon::Load( PlayerNumber pn, CString sText, bool bHeader )
{
static const CString sStopWords[] =
{
"1X",
"DEFAULT",
"OVERHEAD",
"OFF",
};
for( unsigned i=0; i<ARRAYSIZE(sStopWords); i++ )
if( 0==stricmp(sText,sStopWords[i]) )
sText = "";
if( UPPERCASE )
sText.MakeUpper();
sText.Replace( " ", "\n" );
bool bVacant = (sText=="");
int iState = pn*3 + (bHeader?0:(bVacant?1:2));
m_spr.SetState( iState );
m_text.SetText( bHeader ? "" : sText );
m_text.SetZoom( TEXT_ZOOM );
m_text.CropToWidth( TEXT_WIDTH );
}
void OptionIcon::DrawPrimitives()
{
ActorFrame::DrawPrimitives();
}