2005-03-27 03:56:10 +00:00
|
|
|
#include "global.h"
|
|
|
|
|
#include "WheelItemBase.h"
|
|
|
|
|
|
|
|
|
|
WheelItemBaseData::WheelItemBaseData( WheelItemType wit, CString 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 ),
|
|
|
|
|
m_sprBar( cpy.m_sprBar ),
|
|
|
|
|
m_text( cpy.m_text ),
|
|
|
|
|
m_Type( cpy.m_Type ),
|
|
|
|
|
m_color( cpy.m_color )
|
|
|
|
|
{
|
|
|
|
|
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 );
|
|
|
|
|
}
|
|
|
|
|
}
|
2005-03-27 03:56:10 +00:00
|
|
|
|
2005-05-03 01:05:11 +00:00
|
|
|
WheelItemBase::WheelItemBase(CString sType)
|
|
|
|
|
{
|
|
|
|
|
SetName( sType );
|
2005-05-05 03:01:39 +00:00
|
|
|
m_pBar = NULL;
|
2005-05-03 01:05:11 +00:00
|
|
|
Load(sType);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void WheelItemBase::Load( CString sType )
|
2005-03-27 03:56:10 +00:00
|
|
|
{
|
2005-05-03 01:05:11 +00:00
|
|
|
TEXT_X .Load(sType,"TextX");
|
|
|
|
|
TEXT_Y .Load(sType,"TextY");
|
|
|
|
|
TEXT_ON_COMMAND .Load(sType,"TextOnCommand");
|
2005-03-27 03:56:10 +00:00
|
|
|
|
|
|
|
|
m_fPercentGray = 0;
|
|
|
|
|
|
2005-05-03 01:05:11 +00:00
|
|
|
m_sprBar.Load( THEME->GetPathG(sType,"bar") );
|
2005-03-27 03:56:10 +00:00
|
|
|
m_sprBar.SetXY( 0, 0 );
|
2005-04-29 02:42:31 +00:00
|
|
|
this->AddChild( &m_sprBar );
|
2005-05-05 03:01:39 +00:00
|
|
|
m_pBar = &m_sprBar;
|
2005-03-27 03:56:10 +00:00
|
|
|
|
2005-05-03 01:05:11 +00:00
|
|
|
m_text.LoadFromFont( THEME->GetPathF(sType,"text") );
|
2005-03-27 03:56:10 +00:00
|
|
|
m_text.SetShadowLength( 0 );
|
2005-04-29 02:42:31 +00:00
|
|
|
m_text.SetXY( TEXT_X, TEXT_Y );
|
|
|
|
|
m_text.RunCommands( TEXT_ON_COMMAND );
|
|
|
|
|
this->AddChild( &m_text );
|
2005-03-27 03:56:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void WheelItemBase::LoadFromWheelItemBaseData( 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 );
|
2005-03-27 03:56:10 +00:00
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
ASSERT( 0 ); // invalid type
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2005-05-05 03:01:39 +00:00
|
|
|
void WheelItemBase::DrawGrayBar( Actor& bar )
|
2005-05-05 02:48:46 +00:00
|
|
|
{
|
|
|
|
|
if( m_fPercentGray == 0 )
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
bar.SetGlow( RageColor(0,0,0,m_fPercentGray) );
|
|
|
|
|
bar.SetDiffuse( RageColor(0,0,0,0) );
|
|
|
|
|
bar.Draw();
|
|
|
|
|
bar.SetDiffuse( RageColor(0,0,0,1) );
|
|
|
|
|
bar.SetGlow( RageColor(0,0,0,0) );
|
|
|
|
|
}
|
|
|
|
|
|
2005-05-05 03:01:39 +00:00
|
|
|
void WheelItemBase::DrawPrimitives()
|
2005-03-27 03:56:10 +00:00
|
|
|
{
|
2005-04-29 02:42:31 +00:00
|
|
|
ActorFrame::DrawPrimitives();
|
2005-03-27 03:56:10 +00:00
|
|
|
|
2005-05-05 03:01:39 +00:00
|
|
|
if( m_pBar != NULL )
|
|
|
|
|
DrawGrayBar( *m_pBar );
|
2005-03-27 03:56:10 +00:00
|
|
|
}
|
2005-04-29 02:42:31 +00:00
|
|
|
|
2005-03-27 03:56:10 +00:00
|
|
|
/*
|
|
|
|
|
* (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.
|
|
|
|
|
*/
|