Example #1
0
        bool Animation::update(sf::Time elapsedTime)
        {
            m_elapsedTime += elapsedTime;
            if (m_elapsedTime > m_totalDuration)
                m_elapsedTime = m_totalDuration;

            if (m_type == Type::Fade)
                m_widget->setOpacity(m_startOpacity + ((m_elapsedTime.asSeconds() / m_totalDuration.asSeconds()) * (m_endOpacity - m_startOpacity)));
            else if (m_type == Type::Move)
                m_widget->setPosition(m_startPos + ((m_elapsedTime.asSeconds() / m_totalDuration.asSeconds()) * (m_endPos - m_startPos)));
            else if (m_type == Type::Scale)
            {
                m_widget->setPosition(m_startPos + ((m_elapsedTime.asSeconds() / m_totalDuration.asSeconds()) * (m_endPos - m_startPos)));
                m_widget->setSize(m_startSize + ((m_elapsedTime.asSeconds() / m_totalDuration.asSeconds()) * (m_endSize - m_startSize)));
            }

            if (m_elapsedTime == m_totalDuration)
            {
                if (m_finishedCallback != nullptr)
                    m_finishedCallback();

                return true;
            }

            return false;
        }
Example #2
0
void gep::TaskGroup::taskFinished()
{
    uint32 tasksRemainingInGroup = InterlockedDecrement(&m_numRemainingTasks);
    if(tasksRemainingInGroup == 0)
    {
        m_isExecuting = false;
        if(m_finishedCallback)
            m_finishedCallback(m_tasks.toArray());
        m_pTaskQueue->scheduleNextGroup();
    }
}
Example #3
0
 void Animation::finish()
 {
     if (m_finishedCallback != nullptr)
         m_finishedCallback();
 }