Merge pull request #17 from geron-cn/xiaov3

fix actiontimeline step over frame when (noloop play && timespeed>1)
This commit is contained in:
xiaofeng11 2015-04-15 13:41:49 +08:00
commit a8fcaf4f4f
1 changed files with 13 additions and 8 deletions

View File

@ -199,22 +199,27 @@ void ActionTimeline::step(float delta)
} }
_time += delta * _timeSpeed; _time += delta * _timeSpeed;
_currentFrame = (int)(_time / _frameInternal);
if(_time < _endFrame * _frameInternal)
stepToFrame(_currentFrame); {
_currentFrame = (int)(_time / _frameInternal);
if(_time > _endFrame * _frameInternal) stepToFrame(_currentFrame);
}
else
{ {
if(_lastFrameListener != nullptr) if(_lastFrameListener != nullptr)
_lastFrameListener(); _lastFrameListener();
_playing = _loop; _playing = _loop;
if(!_playing) if(!_playing)
{
_time = _endFrame * _frameInternal; _time = _endFrame * _frameInternal;
else _currentFrame = (int)(_time / _frameInternal);
stepToFrame(_currentFrame);
}
else
gotoFrameAndPlay(_startFrame, _endFrame, _loop); gotoFrameAndPlay(_startFrame, _endFrame, _loop);
} }
} }
typedef std::function<void(Node*)> tCallBack; typedef std::function<void(Node*)> tCallBack;