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
-Added sound support through SDL_mixer.
-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;
updateList();
}else{
mList->stopScrolling();
//wait for the sound to finish or we'll never hear it...
while(mTheme->getMenuSelectSound()->isPlaying());
@ -248,6 +250,7 @@ void GuiGameList::updateDetailData()
//these are called when the menu opens/closes
void GuiGameList::onPause()
{
mList->stopScrolling();
mTheme->getMenuOpenSound()->play();
InputManager::unregisterComponent(this);
}

View file

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

View file

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