cocos2dx利用timeline实现控件多种状态显示

void GameWidget::setSignalLevel(int level)
{
    _ui.sig.Text_level->setString(std::to_string(level));

    // load timeline
    auto sigaction = CSLoader::createTimeline(CSB_WIDGET_SIGNAL);
    _ui.sig.FileNode_signal->runAction(sigaction);

    // total 20 frames
    int startframe = level * 20 / 100;
    
    // load status
    sigaction->gotoFrameAndPause(startframe);
}

你可能感兴趣的:(cocos2dx利用timeline实现控件多种状态显示)