2003-02-16 04:01:45 +00:00
|
|
|
#include "global.h"
|
2002-09-03 00:22:12 +00:00
|
|
|
/*
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
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"
|
|
|
|
|
|
2002-09-03 06:33:08 +00:00
|
|
|
#define TEXT_OFFSET_X THEME->GetMetricF("OptionIcon","TextOffsetX")
|
|
|
|
|
#define TEXT_OFFSET_Y THEME->GetMetricF("OptionIcon","TextOffsetY")
|
2002-09-03 00:22:12 +00:00
|
|
|
#define TEXT_H_ALIGN THEME->GetMetricI("OptionIcon","TextHAlign")
|
|
|
|
|
#define TEXT_V_ALIGN THEME->GetMetricI("OptionIcon","TextVAlign")
|
|
|
|
|
#define TEXT_WIDTH THEME->GetMetricI("OptionIcon","TextWidth")
|
2002-09-03 06:33:08 +00:00
|
|
|
#define TEXT_ZOOM THEME->GetMetricF("OptionIcon","TextZoom")
|
2002-09-03 22:31:06 +00:00
|
|
|
#define UPPERCASE THEME->GetMetricB("OptionIcon","Uppercase")
|
2002-09-03 00:22:12 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
OptionIcon::OptionIcon()
|
|
|
|
|
{
|
2003-04-12 17:39:27 +00:00
|
|
|
m_spr.Load( THEME->GetPathToG("OptionIcon frame 3x2") );
|
2002-09-03 06:33:08 +00:00
|
|
|
m_spr.StopAnimating();
|
2002-09-03 00:22:12 +00:00
|
|
|
this->AddChild( &m_spr );
|
|
|
|
|
|
2003-04-12 17:39:27 +00:00
|
|
|
m_text.LoadFromFont( THEME->GetPathToF("OptionIcon") );
|
2003-03-02 01:43:33 +00:00
|
|
|
m_text.EnableShadow( false );
|
2002-09-03 06:33:08 +00:00
|
|
|
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 );
|
2002-09-03 00:22:12 +00:00
|
|
|
this->AddChild( &m_text );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void OptionIcon::Load( PlayerNumber pn, CString sText, bool bHeader )
|
|
|
|
|
{
|
2003-04-05 03:49:03 +00:00
|
|
|
static CString sStopWords[] = { "OFF", "VISIBLE", "VIVID", "STANDARD", "X1", "HOLDS", "DEFAULT", "OVERHEAD" };
|
2002-09-03 22:31:06 +00:00
|
|
|
|
2003-08-02 20:05:46 +00:00
|
|
|
for( int i=0; i<ARRAYSIZE(sStopWords); i++ )
|
2002-09-04 03:49:08 +00:00
|
|
|
if( 0==stricmp(sText,sStopWords[i]) )
|
2002-09-03 22:31:06 +00:00
|
|
|
sText = "";
|
|
|
|
|
|
|
|
|
|
if( UPPERCASE )
|
|
|
|
|
sText.MakeUpper();
|
|
|
|
|
|
2002-09-04 03:49:08 +00:00
|
|
|
sText.Replace( " ", "\n" );
|
|
|
|
|
|
2002-09-03 00:22:12 +00:00
|
|
|
bool bVacant = (sText=="");
|
2002-09-03 06:33:08 +00:00
|
|
|
m_spr.SetState( pn*3 + (bHeader?0:(bVacant?1:2)) );
|
2002-09-03 00:22:12 +00:00
|
|
|
|
2002-09-03 06:33:08 +00:00
|
|
|
m_text.SetText( bHeader ? "" : sText );
|
|
|
|
|
m_text.SetZoom( TEXT_ZOOM );
|
2002-09-03 00:22:12 +00:00
|
|
|
m_text.CropToWidth( TEXT_WIDTH );
|
|
|
|
|
}
|
2002-09-03 06:33:08 +00:00
|
|
|
|
|
|
|
|
void OptionIcon::DrawPrimitives()
|
|
|
|
|
{
|
|
|
|
|
ActorFrame::DrawPrimitives();
|
|
|
|
|
}
|
|
|
|
|
|