Files
itgmania212121/stepmania/src/WheelItemBase.cpp
T

129 lines
3.4 KiB
C++
Raw Normal View History

#include "global.h"
#include "WheelItemBase.h"
2006-01-22 01:00:06 +00:00
WheelItemBaseData::WheelItemBaseData( WheelItemType wit, RString sText, RageColor color )
{
m_Type = wit;
m_sText = sText;
m_color = color;
m_Flags = WheelNotifyIcon::Flags();
}
2005-09-09 03:23:10 +00:00
WheelItemBase::WheelItemBase( const WheelItemBase &cpy ):
ActorFrame( cpy ),
2006-09-13 03:31:58 +00:00
m_bExpanded( cpy.m_bExpanded ),
2005-09-09 03:23:10 +00:00
m_sprBar( cpy.m_sprBar ),
m_text( cpy.m_text ),
m_Type( cpy.m_Type ),
2006-09-13 03:31:58 +00:00
m_color( cpy.m_color )
2005-09-09 03:23:10 +00:00
{
if( cpy.m_pBar == const_cast<Sprite *> (&cpy.m_sprBar) )
m_pBar = &m_sprBar;
if( cpy.GetNumChildren() != 0 )
{
this->AddChild( &m_sprBar );
this->AddChild( &m_text );
}
}
2006-01-22 01:00:06 +00:00
WheelItemBase::WheelItemBase(RString sType)
2005-05-03 01:05:11 +00:00
{
2006-08-10 05:09:14 +00:00
m_bExpanded = false;
2005-05-03 01:05:11 +00:00
SetName( sType );
m_pBar = NULL;
2005-05-03 01:05:11 +00:00
Load(sType);
}
2006-01-22 01:00:06 +00:00
void WheelItemBase::Load( RString sType )
{
2005-05-03 01:05:11 +00:00
TEXT_X .Load(sType,"TextX");
TEXT_Y .Load(sType,"TextY");
TEXT_ON_COMMAND .Load(sType,"TextOnCommand");
2006-04-25 08:46:43 +00:00
m_colorLocked = RageColor(0,0,0,0);
2005-05-03 01:05:11 +00:00
m_sprBar.Load( THEME->GetPathG(sType,"bar") );
m_sprBar.SetXY( 0, 0 );
this->AddChild( &m_sprBar );
m_pBar = &m_sprBar;
2005-05-03 01:05:11 +00:00
m_text.LoadFromFont( THEME->GetPathF(sType,"text") );
m_text.SetShadowLength( 0 );
m_text.SetXY( TEXT_X, TEXT_Y );
m_text.RunCommands( TEXT_ON_COMMAND );
this->AddChild( &m_text );
}
2006-08-10 05:09:14 +00:00
void WheelItemBase::LoadFromWheelItemData( const WheelItemBaseData* pWID )
{
ASSERT( pWID != NULL );
data = pWID;
m_text.SetText(pWID->m_sText);
m_Type = pWID->m_Type;
m_color = pWID->m_color;
// init type specific stuff
switch( pWID->m_Type )
{
case TYPE_GENERIC:
2005-05-05 03:05:22 +00:00
m_text.SetText( data->m_sText );
m_text.SetDiffuse( data->m_color );
break;
default:
ASSERT( 0 ); // invalid type
}
}
void WheelItemBase::DrawGrayBar( Actor& bar )
2005-05-05 02:48:46 +00:00
{
2006-04-25 08:46:43 +00:00
if( m_colorLocked.a == 0 )
2005-05-05 02:48:46 +00:00
return;
RageColor glow = bar.GetGlow();
RageColor diffuse = bar.GetDiffuse();
2006-04-25 08:46:43 +00:00
bar.SetGlow( m_colorLocked );
2005-05-05 02:48:46 +00:00
bar.SetDiffuse( RageColor(0,0,0,0) );
2005-05-05 02:48:46 +00:00
bar.Draw();
bar.SetGlow( glow );
bar.SetDiffuse( diffuse );
2005-05-05 02:48:46 +00:00
}
void WheelItemBase::DrawPrimitives()
{
ActorFrame::DrawPrimitives();
if( m_pBar != NULL )
DrawGrayBar( *m_pBar );
}
/*
* (c) 2001-2004 Chris Danford, Chris Gomez, Glenn Maynard, Josh Allen
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/