Allow onHighlight animations to be interrupted by key presses. This should remove the "lag" people have been experiencing when scrolling through the menu.

This commit is contained in:
Pieter Hulshoff 2016-07-22 14:01:25 +02:00
parent d3d4bdcd41
commit c4c85fa9e8
3 changed files with 23 additions and 2 deletions

View File

@ -208,6 +208,18 @@ bool Page::isIdle()
return idle;
}
bool Page::isGraphicsIdle()
{
bool idle = true;
for(std::vector<Component *>::iterator it = LayerComponents.begin(); it != LayerComponents.end() && idle; ++it)
{
idle = (*it)->isIdle();
}
return idle;
}
void Page::start()
{

View File

@ -74,6 +74,7 @@ public:
void setScrollOffsetIndex(unsigned int i);
unsigned int getScrollOffsetIndex();
bool isIdle();
bool isGraphicsIdle();
bool isMenuIdle();
void setStatusTextComponent(Text *t);
void update(float dt);

View File

@ -346,7 +346,11 @@ void RetroFE::run()
break;
case RETROFE_HIGHLIGHT_EXIT:
if (currentPage_->isIdle())
if ( processUserInput(currentPage_) == RETROFE_HIGHLIGHT_REQUEST)
{
state = RETROFE_HIGHLIGHT_REQUEST;
}
else if (currentPage_->isGraphicsIdle())
{
currentPage_->onNewItemSelected();
currentPage_->highlightEnter();
@ -355,7 +359,11 @@ void RetroFE::run()
break;
case RETROFE_HIGHLIGHT_ENTER:
if (currentPage_->isIdle())
if ( processUserInput(currentPage_) == RETROFE_HIGHLIGHT_REQUEST)
{
state = RETROFE_HIGHLIGHT_REQUEST;
}
else if (currentPage_->isGraphicsIdle())
{
state = RETROFE_IDLE;
}