Fixed scrolldirection namespace issue for linux.

This commit is contained in:
Don Honerbrink
2015-01-30 17:23:46 -06:00
parent 105c40976f
commit 49d2d1b9ac

View File

@@ -101,8 +101,8 @@ void ScrollingList::SetItems(std::vector<ComponentItemBinding *> *spriteList)
AllocateSpritePoints(); AllocateSpritePoints();
} }
void ScrollingList::DeallocateSpritePoints() void ScrollingList::DeallocateSpritePoints()
{ {
unsigned int spriteIndex = FirstSpriteIndex; unsigned int spriteIndex = FirstSpriteIndex;
for(unsigned int i = 0; i < ScrollPoints->size(); ++i) for(unsigned int i = 0; i < ScrollPoints->size(); ++i)
@@ -110,10 +110,10 @@ void ScrollingList::DeallocateSpritePoints()
DeallocateTexture(SpriteList->at(spriteIndex)); DeallocateTexture(SpriteList->at(spriteIndex));
CircularIncrement(spriteIndex, SpriteList); CircularIncrement(spriteIndex, SpriteList);
} }
} }
void ScrollingList::AllocateSpritePoints() void ScrollingList::AllocateSpritePoints()
{ {
unsigned int spriteIndex = FirstSpriteIndex; unsigned int spriteIndex = FirstSpriteIndex;
for(unsigned int i = 0; i < ScrollPoints->size(); ++i) for(unsigned int i = 0; i < ScrollPoints->size(); ++i)
@@ -129,10 +129,10 @@ void ScrollingList::AllocateSpritePoints()
CircularIncrement(spriteIndex, SpriteList); CircularIncrement(spriteIndex, SpriteList);
} }
} }
void ScrollingList::DestroyItems() void ScrollingList::DestroyItems()
{ {
if(SpriteList) if(SpriteList)
{ {
std::vector<ComponentItemBinding *>::iterator it = SpriteList->begin(); std::vector<ComponentItemBinding *>::iterator it = SpriteList->begin();
@@ -160,7 +160,7 @@ void ScrollingList::DestroyItems()
delete SpriteList; delete SpriteList;
SpriteList = NULL; SpriteList = NULL;
} }
} }
void ScrollingList::SetPoints(std::vector<ViewInfo *> *scrollPoints, std::vector<TweenSet *> *tweenPoints) void ScrollingList::SetPoints(std::vector<ViewInfo *> *scrollPoints, std::vector<TweenSet *> *tweenPoints)
@@ -299,15 +299,15 @@ void ScrollingList::FreeGraphicsMemory()
} }
} }
void ScrollingList::TriggerMenuEnterEvent() void ScrollingList::TriggerMenuEnterEvent()
{ {
Focus = true; Focus = true;
if(!ScrollPoints) { return; } if(!ScrollPoints) { return; }
if(!SpriteList) { return; } if(!SpriteList) { return; }
if(SpriteList->size() == 0 ) { return; } if(SpriteList->size() == 0 ) { return; }
if(FirstSpriteIndex >= SpriteList->size()) { return; } if(FirstSpriteIndex >= SpriteList->size()) { return; }
unsigned int spriteIndex = FirstSpriteIndex; unsigned int spriteIndex = FirstSpriteIndex;
for(unsigned int i = 0; i < ScrollPoints->size(); ++i) for(unsigned int i = 0; i < ScrollPoints->size(); ++i)
@@ -322,16 +322,16 @@ void ScrollingList::TriggerMenuEnterEvent()
CircularIncrement(spriteIndex, SpriteList); CircularIncrement(spriteIndex, SpriteList);
} }
} }
void ScrollingList::TriggerMenuExitEvent() void ScrollingList::TriggerMenuExitEvent()
{ {
Focus = false; Focus = false;
if(!ScrollPoints) { return; } if(!ScrollPoints) { return; }
if(!SpriteList) { return; } if(!SpriteList) { return; }
if(SpriteList->size() == 0 ) { return; } if(SpriteList->size() == 0 ) { return; }
if(FirstSpriteIndex >= SpriteList->size()) { return; } if(FirstSpriteIndex >= SpriteList->size()) { return; }
unsigned int spriteIndex = FirstSpriteIndex; unsigned int spriteIndex = FirstSpriteIndex;
for(unsigned int i = 0; i < ScrollPoints->size(); ++i) for(unsigned int i = 0; i < ScrollPoints->size(); ++i)
@@ -346,7 +346,7 @@ void ScrollingList::TriggerMenuExitEvent()
CircularIncrement(spriteIndex, SpriteList); CircularIncrement(spriteIndex, SpriteList);
} }
} }
void ScrollingList::Update(float dt) void ScrollingList::Update(float dt)
{ {
@@ -493,19 +493,19 @@ void ScrollingList::UpdateSprite(unsigned int spriteIndex, unsigned int pointInd
CircularIncrement(spriteIndex, SpriteList); CircularIncrement(spriteIndex, SpriteList);
} }
void ScrollingList::ResetTweens(Component *c, TweenSet *sets, ViewInfo *currentViewInfo, ViewInfo *nextViewInfo, double scrollTime) void ScrollingList::ResetTweens(Component *c, TweenSet *sets, ViewInfo *currentViewInfo, ViewInfo *nextViewInfo, double scrollTime)
{ {
if(!c) { return; } if(!c) { return; }
if(!sets) { return; } if(!sets) { return; }
if(!currentViewInfo) { return; } if(!currentViewInfo) { return; }
if(!nextViewInfo) { return; } if(!nextViewInfo) { return; }
currentViewInfo->SetImageHeight(c->GetBaseViewInfo()->GetImageHeight()); currentViewInfo->SetImageHeight(c->GetBaseViewInfo()->GetImageHeight());
currentViewInfo->SetImageWidth(c->GetBaseViewInfo()->GetImageWidth()); currentViewInfo->SetImageWidth(c->GetBaseViewInfo()->GetImageWidth());
nextViewInfo->SetImageHeight(c->GetBaseViewInfo()->GetImageHeight()); nextViewInfo->SetImageHeight(c->GetBaseViewInfo()->GetImageHeight());
nextViewInfo->SetImageWidth(c->GetBaseViewInfo()->GetImageWidth()); nextViewInfo->SetImageWidth(c->GetBaseViewInfo()->GetImageWidth());
nextViewInfo->SetBackgroundAlpha(c->GetBaseViewInfo()->GetBackgroundAlpha()); nextViewInfo->SetBackgroundAlpha(c->GetBaseViewInfo()->GetBackgroundAlpha());
//todo: delete properly, memory leak (big), proof of concept //todo: delete properly, memory leak (big), proof of concept
c->SetTweens(sets); 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_FONT_SIZE, LINEAR, currentViewInfo->GetFontSize(), nextViewInfo->GetFontSize(), scrollTime));
set->push_back(new Tween(TWEEN_PROPERTY_BACKGROUND_ALPHA, LINEAR, currentViewInfo->GetBackgroundAlpha(), nextViewInfo->GetBackgroundAlpha(), scrollTime)); set->push_back(new Tween(TWEEN_PROPERTY_BACKGROUND_ALPHA, LINEAR, currentViewInfo->GetBackgroundAlpha(), nextViewInfo->GetBackgroundAlpha(), scrollTime));
scrollTween->push_back(set); scrollTween->push_back(set);
} }
bool ScrollingList::AllocateTexture(ComponentItemBinding *s) bool ScrollingList::AllocateTexture(ComponentItemBinding *s)
@@ -626,7 +626,7 @@ void ScrollingList::SetScrollDirection(ScrollDirection direction)
{ {
RequestedScrollDirection = direction; RequestedScrollDirection = direction;
ScrollStopRequested = (direction == ScrollDirection::ScrollDirectionIdle); ScrollStopRequested = (direction == ScrollDirectionIdle);
} }
void ScrollingList::RemoveSelectedItem() void ScrollingList::RemoveSelectedItem()
@@ -670,7 +670,7 @@ ComponentItemBinding* ScrollingList::GetSelectedCollectionItemSprite()
ComponentItemBinding *item = NULL; ComponentItemBinding *item = NULL;
if(SpriteList && SpriteList->size() > 0) if(SpriteList && SpriteList->size() > 0)
{ {ScrollDirection
int index = (FirstSpriteIndex + SelectedSpriteListIndex) % SpriteList->size(); int index = (FirstSpriteIndex + SelectedSpriteListIndex) % SpriteList->size();
item = SpriteList->at(index); item = SpriteList->at(index);
@@ -710,7 +710,7 @@ void ScrollingList::RemoveComponentForNotifications(MenuNotifierInterface *c)
} }
} }
} }
ScrollDirection
ComponentItemBinding* ScrollingList::GetPendingSelectedCollectionItemSprite() 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) int ScrollingList::CircularIncrement(unsigned int index, unsigned int offset, std::vector<ComponentItemBinding *> *list)
{ {
unsigned int end = index + offset; unsigned int end = index + offset;
while(end >= list->size() && list->size() > 0) while(end >= list->size() && list->size() > 0)
{ {
end -= list->size(); end -= list->size();
} }
return end; return end;
} }
void ScrollingList::CircularIncrement(unsigned int &index, std::vector<ComponentItemBinding*> *list) void ScrollingList::CircularIncrement(unsigned int &index, std::vector<ComponentItemBinding*> *list)