mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2025-12-24 15:48:52 +01:00
Fixing scrollingList (commit error).
This commit is contained in:
parent
49d2d1b9ac
commit
e84f70673b
@ -101,8 +101,8 @@ void ScrollingList::SetItems(std::vector<ComponentItemBinding *> *spriteList)
|
||||
AllocateSpritePoints();
|
||||
}
|
||||
|
||||
void ScrollingList::DeallocateSpritePoints()
|
||||
{
|
||||
void ScrollingList::DeallocateSpritePoints()
|
||||
{
|
||||
unsigned int spriteIndex = FirstSpriteIndex;
|
||||
|
||||
for(unsigned int i = 0; i < ScrollPoints->size(); ++i)
|
||||
@ -110,10 +110,10 @@ void ScrollingList::DeallocateSpritePoints()
|
||||
DeallocateTexture(SpriteList->at(spriteIndex));
|
||||
CircularIncrement(spriteIndex, SpriteList);
|
||||
}
|
||||
}
|
||||
|
||||
void ScrollingList::AllocateSpritePoints()
|
||||
{
|
||||
}
|
||||
|
||||
void ScrollingList::AllocateSpritePoints()
|
||||
{
|
||||
unsigned int spriteIndex = FirstSpriteIndex;
|
||||
|
||||
for(unsigned int i = 0; i < ScrollPoints->size(); ++i)
|
||||
@ -129,10 +129,10 @@ void ScrollingList::AllocateSpritePoints()
|
||||
|
||||
CircularIncrement(spriteIndex, SpriteList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ScrollingList::DestroyItems()
|
||||
{
|
||||
void ScrollingList::DestroyItems()
|
||||
{
|
||||
if(SpriteList)
|
||||
{
|
||||
std::vector<ComponentItemBinding *>::iterator it = SpriteList->begin();
|
||||
@ -160,7 +160,7 @@ void ScrollingList::DestroyItems()
|
||||
delete SpriteList;
|
||||
SpriteList = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ScrollingList::SetPoints(std::vector<ViewInfo *> *scrollPoints, std::vector<TweenSet *> *tweenPoints)
|
||||
@ -299,15 +299,15 @@ void ScrollingList::FreeGraphicsMemory()
|
||||
}
|
||||
}
|
||||
|
||||
void ScrollingList::TriggerMenuEnterEvent()
|
||||
{
|
||||
Focus = true;
|
||||
|
||||
if(!ScrollPoints) { return; }
|
||||
if(!SpriteList) { return; }
|
||||
if(SpriteList->size() == 0 ) { return; }
|
||||
if(FirstSpriteIndex >= SpriteList->size()) { return; }
|
||||
|
||||
void ScrollingList::TriggerMenuEnterEvent()
|
||||
{
|
||||
Focus = true;
|
||||
|
||||
if(!ScrollPoints) { return; }
|
||||
if(!SpriteList) { return; }
|
||||
if(SpriteList->size() == 0 ) { return; }
|
||||
if(FirstSpriteIndex >= SpriteList->size()) { return; }
|
||||
|
||||
unsigned int spriteIndex = FirstSpriteIndex;
|
||||
|
||||
for(unsigned int i = 0; i < ScrollPoints->size(); ++i)
|
||||
@ -322,16 +322,16 @@ void ScrollingList::TriggerMenuEnterEvent()
|
||||
|
||||
CircularIncrement(spriteIndex, SpriteList);
|
||||
}
|
||||
}
|
||||
|
||||
void ScrollingList::TriggerMenuExitEvent()
|
||||
{
|
||||
Focus = false;
|
||||
if(!ScrollPoints) { return; }
|
||||
if(!SpriteList) { return; }
|
||||
if(SpriteList->size() == 0 ) { return; }
|
||||
if(FirstSpriteIndex >= SpriteList->size()) { return; }
|
||||
|
||||
}
|
||||
|
||||
void ScrollingList::TriggerMenuExitEvent()
|
||||
{
|
||||
Focus = false;
|
||||
if(!ScrollPoints) { return; }
|
||||
if(!SpriteList) { return; }
|
||||
if(SpriteList->size() == 0 ) { return; }
|
||||
if(FirstSpriteIndex >= SpriteList->size()) { return; }
|
||||
|
||||
unsigned int spriteIndex = FirstSpriteIndex;
|
||||
|
||||
for(unsigned int i = 0; i < ScrollPoints->size(); ++i)
|
||||
@ -346,7 +346,7 @@ void ScrollingList::TriggerMenuExitEvent()
|
||||
|
||||
CircularIncrement(spriteIndex, SpriteList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ScrollingList::Update(float dt)
|
||||
{
|
||||
@ -493,19 +493,19 @@ void ScrollingList::UpdateSprite(unsigned int spriteIndex, unsigned int pointInd
|
||||
CircularIncrement(spriteIndex, SpriteList);
|
||||
}
|
||||
|
||||
void ScrollingList::ResetTweens(Component *c, TweenSet *sets, ViewInfo *currentViewInfo, ViewInfo *nextViewInfo, double scrollTime)
|
||||
{
|
||||
if(!c) { return; }
|
||||
if(!sets) { return; }
|
||||
if(!currentViewInfo) { return; }
|
||||
if(!nextViewInfo) { return; }
|
||||
|
||||
void ScrollingList::ResetTweens(Component *c, TweenSet *sets, ViewInfo *currentViewInfo, ViewInfo *nextViewInfo, double scrollTime)
|
||||
{
|
||||
if(!c) { return; }
|
||||
if(!sets) { return; }
|
||||
if(!currentViewInfo) { return; }
|
||||
if(!nextViewInfo) { return; }
|
||||
|
||||
currentViewInfo->SetImageHeight(c->GetBaseViewInfo()->GetImageHeight());
|
||||
currentViewInfo->SetImageWidth(c->GetBaseViewInfo()->GetImageWidth());
|
||||
nextViewInfo->SetImageHeight(c->GetBaseViewInfo()->GetImageHeight());
|
||||
nextViewInfo->SetImageWidth(c->GetBaseViewInfo()->GetImageWidth());
|
||||
nextViewInfo->SetBackgroundAlpha(c->GetBaseViewInfo()->GetBackgroundAlpha());
|
||||
|
||||
|
||||
//todo: delete properly, memory leak (big), proof of concept
|
||||
c->SetTweens(sets);
|
||||
|
||||
@ -544,7 +544,7 @@ void ScrollingList::ResetTweens(Component *c, TweenSet *sets, ViewInfo *currentV
|
||||
set->push_back(new Tween(TWEEN_PROPERTY_FONT_SIZE, LINEAR, currentViewInfo->GetFontSize(), nextViewInfo->GetFontSize(), scrollTime));
|
||||
set->push_back(new Tween(TWEEN_PROPERTY_BACKGROUND_ALPHA, LINEAR, currentViewInfo->GetBackgroundAlpha(), nextViewInfo->GetBackgroundAlpha(), scrollTime));
|
||||
scrollTween->push_back(set);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool ScrollingList::AllocateTexture(ComponentItemBinding *s)
|
||||
@ -626,7 +626,7 @@ void ScrollingList::SetScrollDirection(ScrollDirection direction)
|
||||
{
|
||||
RequestedScrollDirection = direction;
|
||||
|
||||
ScrollStopRequested = (direction == ScrollDirectionIdle);
|
||||
ScrollStopRequested = (direction == ScrollDirection::ScrollDirectionIdle);
|
||||
}
|
||||
|
||||
void ScrollingList::RemoveSelectedItem()
|
||||
@ -670,7 +670,7 @@ ComponentItemBinding* ScrollingList::GetSelectedCollectionItemSprite()
|
||||
ComponentItemBinding *item = NULL;
|
||||
|
||||
if(SpriteList && SpriteList->size() > 0)
|
||||
{ScrollDirection
|
||||
{
|
||||
int index = (FirstSpriteIndex + SelectedSpriteListIndex) % SpriteList->size();
|
||||
|
||||
item = SpriteList->at(index);
|
||||
@ -710,7 +710,7 @@ void ScrollingList::RemoveComponentForNotifications(MenuNotifierInterface *c)
|
||||
}
|
||||
}
|
||||
}
|
||||
ScrollDirection
|
||||
|
||||
|
||||
ComponentItemBinding* ScrollingList::GetPendingSelectedCollectionItemSprite()
|
||||
{
|
||||
@ -774,17 +774,17 @@ void ScrollingList::CircularDecrement(unsigned int &index, std::vector<ViewInfo*
|
||||
}
|
||||
}
|
||||
|
||||
int ScrollingList::CircularIncrement(unsigned int index, unsigned int offset, std::vector<ComponentItemBinding *> *list)
|
||||
{
|
||||
unsigned int end = index + offset;
|
||||
|
||||
while(end >= list->size() && list->size() > 0)
|
||||
{
|
||||
end -= list->size();
|
||||
}
|
||||
|
||||
return end;
|
||||
}
|
||||
int ScrollingList::CircularIncrement(unsigned int index, unsigned int offset, std::vector<ComponentItemBinding *> *list)
|
||||
{
|
||||
unsigned int end = index + offset;
|
||||
|
||||
while(end >= list->size() && list->size() > 0)
|
||||
{
|
||||
end -= list->size();
|
||||
}
|
||||
|
||||
return end;
|
||||
}
|
||||
|
||||
|
||||
void ScrollingList::CircularIncrement(unsigned int &index, std::vector<ComponentItemBinding*> *list)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user