From 8df517437cbadf3f0a5c6d2105318d07037d0031 Mon Sep 17 00:00:00 2001 From: emb <> Date: Wed, 4 Feb 2015 07:52:46 -0600 Subject: [PATCH] Fixed updating for reloadable components when paging up/down. --- RetroFE/Source/Graphics/Component/ScrollingList.cpp | 13 +++++++++++-- RetroFE/Source/Graphics/Component/ScrollingList.h | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/RetroFE/Source/Graphics/Component/ScrollingList.cpp b/RetroFE/Source/Graphics/Component/ScrollingList.cpp index ea2248e..9c4daaa 100644 --- a/RetroFE/Source/Graphics/Component/ScrollingList.cpp +++ b/RetroFE/Source/Graphics/Component/ScrollingList.cpp @@ -48,6 +48,7 @@ ScrollingList::ScrollingList(Configuration &c, , FirstSpriteIndex(0) , SelectedSpriteListIndex(0) , ScrollStopRequested(true) + , NotifyAllRequested(false) , CurrentScrollDirection(ScrollDirectionIdle) , RequestedScrollDirection(ScrollDirectionIdle) , CurrentScrollState(ScrollStateIdle) @@ -73,6 +74,7 @@ ScrollingList::~ScrollingList() void ScrollingList::SetItems(std::vector *spriteList) { + NotifyAllRequested = true; SpriteList = spriteList; FirstSpriteIndex = 0; @@ -187,7 +189,6 @@ void ScrollingList::SetPoints(std::vector *scrollPoints, std::vector ViewInfo *info = scrollPoints->at(i); MaxLayer = (MaxLayer < info->GetLayer()) ? MaxLayer : info->GetLayer(); } - } void ScrollingList::SetSelectedIndex(int selectedIndex) @@ -257,6 +258,7 @@ unsigned int ScrollingList::GetNextTween(unsigned int currentIndex, std::vector< void ScrollingList::PageUp() { + NotifyAllRequested = true; DeallocateSpritePoints(); if(SpriteList && ScrollPoints && ScrollPoints->size() > 2) @@ -277,6 +279,8 @@ void ScrollingList::PageUp() void ScrollingList::PageDown() { + NotifyAllRequested = true; + DeallocateSpritePoints(); if(SpriteList && ScrollPoints && ScrollPoints->size() > 2) @@ -315,6 +319,7 @@ void ScrollingList::FreeGraphicsMemory() void ScrollingList::TriggerMenuEnterEvent() { Focus = true; + NotifyAllRequested = true; if(!ScrollPoints) { return; } if(!SpriteList) { return; } @@ -340,6 +345,8 @@ void ScrollingList::TriggerMenuEnterEvent() void ScrollingList::TriggerMenuExitEvent() { Focus = false; + NotifyAllRequested = true; + if(!ScrollPoints) { return; } if(!SpriteList) { return; } if(SpriteList->size() == 0 ) { return; } @@ -455,7 +462,7 @@ void ScrollingList::Update(float dt) CircularIncrement(spriteIndex, SpriteList); } - if(scrollStopped) + if(scrollStopped || NotifyAllRequested) { ComponentItemBinding *sprite = GetPendingCollectionItemSprite(); Item *item = NULL; @@ -481,6 +488,8 @@ void ScrollingList::Update(float dt) CurrentScrollState = ScrollStateIdle; } } + + NotifyAllRequested = false; } void ScrollingList::UpdateSprite(unsigned int spriteIndex, unsigned int pointIndex, bool newScroll, float dt, double nextScrollTime) diff --git a/RetroFE/Source/Graphics/Component/ScrollingList.h b/RetroFE/Source/Graphics/Component/ScrollingList.h index 4c4ebfd..c2c0c9c 100644 --- a/RetroFE/Source/Graphics/Component/ScrollingList.h +++ b/RetroFE/Source/Graphics/Component/ScrollingList.h @@ -104,7 +104,7 @@ private: unsigned int FirstSpriteIndex; unsigned int SelectedSpriteListIndex; bool ScrollStopRequested; - + bool NotifyAllRequested; ScrollDirection CurrentScrollDirection; ScrollDirection RequestedScrollDirection; ScrollState CurrentScrollState;