Example #1
0
//------------------------------------------------------------------------
// Load an animation from the file.
// ----------------------------------------------------------------------
// Param -> IN:
//      const char*:    Path to the animation file.
//------------------------------------------------------------------------
FlyAnimation* FlyAnimManager::LoadAnimation( const char* cFilename )
{
    AnimationNode node;
    FlyAnimation* pAnimation;

    // Check whether the animation is loaded ?
    if( (pAnimation = GetAnimationByName(cFilename)) )
        return pAnimation;

    // Create a new animation.
    pAnimation = new FlyAnimation();
    if( !pAnimation ) return NULL;

    // Load the animation file.
    if( FAILED(pAnimation->LoadAnimation(cFilename)) )
    {
        delete pAnimation;
        return NULL;
    }

    // Add the new animation resource node.
    node.pAnim = pAnimation;
    node.nReference = 0;
    m_Animations.push_back( node );

    return pAnimation;
}
Example #2
0
	void Puppet::Play(const std::string &animationName, bool isLooping)
	{
		currentAnimation = GetAnimationByName(animationName);

		if (currentAnimation)
		{
			this->isPlaying = true;
			this->isLooping = isLooping;
		}

	}
Example #3
0
//------------------------------------------------------------------------
// Create an empty animation manually.
// ----------------------------------------------------------------------
// Param -> IN:
//      const char*     Name of the empty animation.
//------------------------------------------------------------------------
FlyAnimation* FlyAnimManager::CreateManualAnimation( const char* cName )
{
    AnimationNode node;
    FlyAnimation* pAnimation;

    // Check whether the animation has existed ?
    if( (pAnimation = GetAnimationByName(cName)) )
        return pAnimation;

    // Create a new animation.
    pAnimation = new FlyAnimation();
    if( !pAnimation ) return NULL;
    pAnimation->SetName( cName );

    // Add the new animation resource node.
    node.pAnim = pAnimation;
    node.nReference = 0;
    m_Animations.push_back( node );

    return pAnimation;
}