Add ActorFrame::DeleteChildrenWhenDone, to call DeleteAllChildren automatically.

Move movie GainFocus/LoseFocus handling to Sprite.
Visualizations are part of Background, not BGAnimation; move them there.  Remove BGAnimation::LoadFromVisualization and BGAnimationLayer::LoadFromVisualization.
This commit is contained in:
Glenn Maynard
2005-01-15 20:32:35 +00:00
parent f4a51bef4d
commit 66d39dd65c
10 changed files with 93 additions and 76 deletions
+1 -35
View File
@@ -108,16 +108,6 @@ void BGAnimationLayer::LoadFromMovie( const CString& sMoviePath )
this->AddChild( pSprite );
}
void BGAnimationLayer::LoadFromVisualization( const CString& sMoviePath )
{
Init();
Sprite* pSprite = new Sprite;
this->AddChild( pSprite );
pSprite->LoadBG( sMoviePath );
pSprite->StretchTo( FullScreenRectF );
pSprite->SetBlendMode( BLEND_ADD );
}
void BGAnimationLayer::LoadFromAniLayerFile( const CString& sPath )
{
@@ -751,23 +741,6 @@ void BGAnimationLayer::GainFocus( float fRate, bool bRewindMovie, bool bLoop )
{
m_fUpdateRate = fRate;
if( !m_SubActors.size() )
return;
//
// The order of these actions is important.
// At this point, the movie is probably paused (by LoseFocus()).
// Play the movie, then set the playback rate (which can
// potentially pause the movie again).
//
// TODO: Don't special case subActor[0]. The movie layer should be set up with
// a LoseFocusCommand that pauses, and a GainFocusCommand that plays.
if( bRewindMovie )
RunCommandOnChildren( ParseCommands("position,0") );
RunCommandOnChildren( ParseCommands(ssprintf("loop,%i",bLoop)) );
RunCommandOnChildren( ParseCommands("play") );
RunCommandOnChildren( ParseCommands(ssprintf("rate,%f",fRate)) );
if( m_fRepeatCommandEverySeconds == -1 ) // if not repeating
{
/* Yuck. We send OnCommand on load, since that's what's wanted for
@@ -779,19 +752,12 @@ void BGAnimationLayer::GainFocus( float fRate, bool bRewindMovie, bool bLoop )
PlayCommand( "On" );
}
PlayCommand( "GainFocus" );
ActorFrame::GainFocus( fRate, bRewindMovie, bLoop );
}
void BGAnimationLayer::LoseFocus()
{
if( !m_SubActors.size() )
return;
RunCommandOnChildren( ParseCommands("pause") );
PlayCommand( "LoseFocus" );
ActorFrame::LoseFocus();
}
void BGAnimationLayer::PlayCommand( const CString &sCommandName )