Fixed game list continuing to scroll after you open a menu or start a game.

This commit is contained in:
Aloshi 2012-10-14 12:49:57 -05:00
parent 03995a66bb
commit c2b970f2cf
4 changed files with 16 additions and 3 deletions

View file

@ -1,3 +1,6 @@
October 14
-Fixed game list continuing to scroll when a menu is opened or a game is started.
October 13 October 13
-Added sound support through SDL_mixer. -Added sound support through SDL_mixer.
-Added new theme tags for defining menu sounds. See THEMES.md for details. -Added new theme tags for defining menu sounds. See THEMES.md for details.

View file

@ -123,6 +123,8 @@ void GuiGameList::onInput(InputManager::InputButton button, bool keyDown)
mFolder = (FolderData*)file; mFolder = (FolderData*)file;
updateList(); updateList();
}else{ }else{
mList->stopScrolling();
//wait for the sound to finish or we'll never hear it... //wait for the sound to finish or we'll never hear it...
while(mTheme->getMenuSelectSound()->isPlaying()); while(mTheme->getMenuSelectSound()->isPlaying());
@ -248,6 +250,7 @@ void GuiGameList::updateDetailData()
//these are called when the menu opens/closes //these are called when the menu opens/closes
void GuiGameList::onPause() void GuiGameList::onPause()
{ {
mList->stopScrolling();
mTheme->getMenuOpenSound()->play(); mTheme->getMenuOpenSound()->play();
InputManager::unregisterComponent(this); InputManager::unregisterComponent(this);
} }

View file

@ -103,12 +103,18 @@ void GuiList<listType>::onInput(InputManager::InputButton button, bool keyDown)
}else{ }else{
if((button == InputManager::DOWN && mScrollDir > 0) || (button == InputManager::UP && mScrollDir < 0)) if((button == InputManager::DOWN && mScrollDir > 0) || (button == InputManager::UP && mScrollDir < 0))
{ {
stopScrolling();
}
}
}
}
template <typename listType>
void GuiList<listType>::stopScrolling()
{
mScrollAccumulator = 0; mScrollAccumulator = 0;
mScrolling = false; mScrolling = false;
mScrollDir = 0; mScrollDir = 0;
}
}
}
} }
template <typename listType> template <typename listType>

View file

@ -30,6 +30,7 @@ public:
std::string getSelectedName(); std::string getSelectedName();
listType getSelectedObject(); listType getSelectedObject();
int getSelection(); int getSelection();
void stopScrolling();
bool isScrolling(); bool isScrolling();
void setSelectorColor(int selectorColor); void setSelectorColor(int selectorColor);