예제 #1
0
파일: Anim.cpp 프로젝트: APerennec/GWEN
void Gwen::Anim::Think()
{
	Gwen::Anim::Animation::List::iterator it = g_Animations.begin();

	if ( it != g_Animations.end() )
	{
		Gwen::Anim::Animation::ChildList::iterator itChild;
		Gwen::Anim::Animation* anim;

		do
		{
			if ( ( itChild = it->second.begin() ) != it->second.end() )
			{
				do
				{
					anim = *itChild;
					anim->Think();

					if ( anim->Finished() )
					{
						itChild = it->second.erase( itChild );
						delete anim;
					}
					else
					{
						++itChild;
					}
				}
				while ( itChild != it->second.end() );
			}
		}
		while ( ++it != g_Animations.end() );
	}
}
예제 #2
0
파일: Anim.cpp 프로젝트: Hongtae/bullet3
void Gwen::Anim::Cancel(Gwen::Controls::Base* control)
{
	/* cannot use std::list iterator with algoryhtmns based on pointers
	struct AnimDeletePredicate 
	{
		AnimDeletePredicate( Gwen::Controls::Base* control )
		{
			this->control = control;
		}

		bool operator() ( Gwen::Anim::Animation* anim ) 
		{
			return anim->m_Control == control;
		}

		Gwen::Controls::Base* control;
	};

	std::remove_if ( g_Animations.begin(), g_Animations.end(), AnimDeletePredicate( control ) );
	*/
	Gwen::Anim::Animation::List::iterator iAnimations;
	if ((iAnimations = g_Animations.find(control)) != g_Animations.end())
	{
		Gwen::Anim::Animation::ChildList& ChildAnimationsForControl = iAnimations->second;
		Gwen::Anim::Animation::ChildList::iterator iAnimationChild = ChildAnimationsForControl.begin();
		if (iAnimationChild != ChildAnimationsForControl.end())
		{
			do
			{
				delete (*iAnimationChild);
			} while (++iAnimationChild != ChildAnimationsForControl.end());
		}
		g_Animations.erase(iAnimations);
	}
}