Fix scrollingPeriod_ in case of incorrect initialisation or update.

This commit is contained in:
Pieter Hulshoff 2017-01-04 20:52:37 +01:00
parent cbcfc498a3
commit 2b2b6bc7ce
2 changed files with 9 additions and 2 deletions

View File

@ -78,7 +78,7 @@ ScrollingList::ScrollingList(const ScrollingList &copy)
, selectedOffsetIndex_(copy.selectedOffsetIndex_)
, scrollAcceleration_(copy.scrollAcceleration_)
, startScrollTime_(copy.startScrollTime_)
, scrollPeriod_(0)
, scrollPeriod_(copy.startScrollTime_)
, config_(copy.config_)
, scaleX_(copy.scaleX_)
, scaleY_(copy.scaleY_)
@ -367,6 +367,14 @@ void ScrollingList::triggerHighlightExitEvent( int menuIndex )
void ScrollingList::update(float dt)
{
// Check if scrollPeriod_ has been properly initialised already or if something went wrong
// while updating the scrollPeriod_
if(scrollPeriod_ < scrollAcceleration_)
{
scrollPeriod_ = startScrollTime_;
}
Component::update(dt);
if(components_.size() == 0) return;

View File

@ -313,7 +313,6 @@ void RetroFE::run()
case RETROFE_ENTER:
if(currentPage_->isIdle())
{
currentPage_->resetScrollPeriod();
state = RETROFE_IDLE;
}
break;