diff --git a/changelog.txt b/changelog.txt index c6b749e1c..d47318074 100644 --- a/changelog.txt +++ b/changelog.txt @@ -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. diff --git a/src/components/GuiGameList.cpp b/src/components/GuiGameList.cpp index f9275589d..a74871602 100644 --- a/src/components/GuiGameList.cpp +++ b/src/components/GuiGameList.cpp @@ -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); } diff --git a/src/components/GuiList.cpp b/src/components/GuiList.cpp index 9e72a6b3c..ff9adfdaa 100644 --- a/src/components/GuiList.cpp +++ b/src/components/GuiList.cpp @@ -103,14 +103,20 @@ void GuiList::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 +void GuiList::stopScrolling() +{ + mScrollAccumulator = 0; + mScrolling = false; + mScrollDir = 0; +} + template void GuiList::onTick(int deltaTime) { diff --git a/src/components/GuiList.h b/src/components/GuiList.h index ab737edae..9a38702d3 100644 --- a/src/components/GuiList.h +++ b/src/components/GuiList.h @@ -30,6 +30,7 @@ public: std::string getSelectedName(); listType getSelectedObject(); int getSelection(); + void stopScrolling(); bool isScrolling(); void setSelectorColor(int selectorColor);