Пример #1
0
void StateAnim::setState(const std::string& sName, bool bKeepAttr)
{
    if (m_sCurStateName == sName) {
        return;
    }
    if (!m_sCurStateName.empty()) {
        m_States[m_sCurStateName].m_pAnim->abort();
    }
    switchToNewState(sName, bKeepAttr);
}
Пример #2
0
bool StateAnim::step()
{
    // Make sure the object isn't deleted until the end of the method.
    AnimPtr tempThis = shared_from_this();  

    if (!m_sCurStateName.empty()) {
        const AnimState& curState = m_States[m_sCurStateName];
        bool bDone = curState.m_pAnim->step();
        if (bDone) {
            switchToNewState(curState.m_sNextName, false);
        }
    }
    return false;
}
Пример #3
0
void StateAnim::setState(const std::string& sName, bool bKeepAttr)
{
    if (m_sCurStateName == sName) {
        return;
    }
    if (!(Player::get()->isPlaying())) {
        throw(Exception(AVG_ERR_UNSUPPORTED,
                "Animation playback can only be started when the player is running."));
    }

    if (!m_sCurStateName.empty()) {
        m_States[m_sCurStateName].m_pAnim->abort();
    }
    switchToNewState(sName, bKeepAttr);
}
Пример #4
0
bool StateAnim::step()
{
    // Make sure the object isn't deleted until the end of the method.
    AnimPtr tempThis = shared_from_this();  

    if (!m_sCurStateName.empty()) {
        const AnimState& curState = m_States[m_sCurStateName];
        AnimPtr pAnim = curState.m_pAnim;
        bool bDone;
        if (pAnim->isRunning()) {
            bDone = curState.m_pAnim->step();
        } else {
            // Special case: AttrAnim stopped because other animation hijacked it.
            bDone = true;
        }
        if (bDone) {
            switchToNewState(curState.m_sNextName, false);
        }
    }
    return false;
}