mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2025-12-13 18:28:52 +01:00
Renamed TweenAttributes to TweenSets.
This commit is contained in:
parent
f9410748f1
commit
dafb0a9b51
@ -23,11 +23,11 @@ TweenSet::~TweenSet()
|
||||
|
||||
void TweenSet::DestroyTweens()
|
||||
{
|
||||
std::map<std::string, std::map<int, TweenSets *> >::iterator it = TweenMap.begin();
|
||||
std::map<std::string, std::map<int, TweenAttributes *> >::iterator it = TweenMap.begin();
|
||||
|
||||
while(it != TweenMap.end())
|
||||
{
|
||||
std::map<int, TweenSets *>::iterator it2 = (it->second).begin();
|
||||
std::map<int, TweenAttributes *>::iterator it2 = (it->second).begin();
|
||||
|
||||
while(it2 != (it->second).end())
|
||||
{
|
||||
@ -40,22 +40,22 @@ void TweenSet::DestroyTweens()
|
||||
}
|
||||
}
|
||||
|
||||
TweenSet::TweenSets *TweenSet::GetTween(std::string tween)
|
||||
TweenSet::TweenAttributes *TweenSet::GetTween(std::string tween)
|
||||
{
|
||||
return GetTween(tween, -1);
|
||||
}
|
||||
|
||||
TweenSet::TweenSets *TweenSet::GetTween(std::string tween, int index)
|
||||
TweenSet::TweenAttributes *TweenSet::GetTween(std::string tween, int index)
|
||||
{
|
||||
return FindTween(TweenMap[tween], index);
|
||||
}
|
||||
|
||||
void TweenSet::SetTween(std::string tween, int index, TweenSets *set)
|
||||
void TweenSet::SetTween(std::string tween, int index, TweenAttributes *set)
|
||||
{
|
||||
TweenMap[tween][index] = set;
|
||||
}
|
||||
|
||||
TweenSet::TweenSets *TweenSet::FindTween(std::map<int, TweenSets *> &tweens, int index)
|
||||
TweenSet::TweenAttributes *TweenSet::FindTween(std::map<int, TweenAttributes *> &tweens, int index)
|
||||
{
|
||||
if(tweens.find(index) == tweens.end())
|
||||
{
|
||||
@ -63,7 +63,7 @@ TweenSet::TweenSets *TweenSet::FindTween(std::map<int, TweenSets *> &tweens, int
|
||||
|
||||
if(tweens.find(index) == tweens.end())
|
||||
{
|
||||
TweenSets *set = new TweenSets();
|
||||
TweenAttributes *set = new TweenAttributes();
|
||||
tweens[index] = set;
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,21 +20,19 @@
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
|
||||
|
||||
class TweenSet
|
||||
{
|
||||
public:
|
||||
~TweenSet();
|
||||
typedef std::vector<std::vector<Tween *> *> TweenSets;
|
||||
typedef std::vector<std::vector<Tween *> *> TweenAttributes;
|
||||
|
||||
TweenSets *GetTween(std::string tween);
|
||||
TweenSets *GetTween(std::string tween, int index);
|
||||
void SetTween(std::string tween, int index, TweenSets *set);
|
||||
TweenAttributes *GetTween(std::string tween);
|
||||
TweenAttributes *GetTween(std::string tween, int index);
|
||||
void SetTween(std::string tween, int index, TweenAttributes *set);
|
||||
|
||||
private:
|
||||
TweenSets *FindTween(std::map<int, TweenSets *> &tweens, int index);
|
||||
TweenAttributes *FindTween(std::map<int, TweenAttributes *> &tweens, int index);
|
||||
void DestroyTweens();
|
||||
|
||||
std::map<std::string, std::map<int, TweenSets *> > TweenMap;
|
||||
std::map<std::string, std::map<int, TweenAttributes *> > TweenMap;
|
||||
};
|
||||
|
||||
@ -45,7 +45,7 @@ public:
|
||||
bool IsMenuScrolling();
|
||||
std::string GetCollectionName();
|
||||
void SetCollectionName(std::string collectionName);
|
||||
typedef std::vector<std::vector<Tween *> *> TweenSets;
|
||||
typedef std::vector<std::vector<Tween *> *> TweenAttributes;
|
||||
|
||||
TweenSet *GetTweens() { return Tweens; }
|
||||
|
||||
@ -119,7 +119,7 @@ private:
|
||||
bool IsTweenSequencingComplete();
|
||||
void ResetTweenSequence(std::vector<ViewInfo *> *tweens);
|
||||
TweenSet *Tweens;
|
||||
TweenSets *CurrentTweens;
|
||||
TweenAttributes *CurrentTweens;
|
||||
unsigned int CurrentTweenIndex;
|
||||
|
||||
bool CurrentTweenComplete;
|
||||
|
||||
@ -74,7 +74,7 @@ ScrollingList::~ScrollingList()
|
||||
|
||||
void ScrollingList::SetItems(std::vector<ComponentItemBinding *> *spriteList)
|
||||
{
|
||||
NotifyAllRequested = true;
|
||||
NotifyAllRequested = true;
|
||||
SpriteList = spriteList;
|
||||
FirstSpriteIndex = 0;
|
||||
|
||||
@ -103,20 +103,20 @@ void ScrollingList::SetItems(std::vector<ComponentItemBinding *> *spriteList)
|
||||
AllocateSpritePoints();
|
||||
}
|
||||
|
||||
void ScrollingList::SetScrollAcceleration(float value)
|
||||
{
|
||||
ScrollAcceleration = value;
|
||||
}
|
||||
|
||||
void ScrollingList::SetStartScrollTime(float value)
|
||||
{
|
||||
StartScrollTime = value;
|
||||
}
|
||||
void ScrollingList::SetScrollAcceleration(float value)
|
||||
{
|
||||
ScrollAcceleration = value;
|
||||
}
|
||||
|
||||
void ScrollingList::SetStartScrollTime(float value)
|
||||
{
|
||||
StartScrollTime = value;
|
||||
}
|
||||
|
||||
void ScrollingList::DeallocateSpritePoints()
|
||||
{
|
||||
if(!SpriteList) { return; }
|
||||
|
||||
void ScrollingList::DeallocateSpritePoints()
|
||||
{
|
||||
if(!SpriteList) { return; }
|
||||
|
||||
unsigned int spriteIndex = FirstSpriteIndex;
|
||||
|
||||
for(unsigned int i = 0; i < ScrollPoints->size(); ++i)
|
||||
@ -124,15 +124,15 @@ void ScrollingList::DeallocateSpritePoints()
|
||||
DeallocateTexture(SpriteList->at(spriteIndex));
|
||||
CircularIncrement(spriteIndex, SpriteList);
|
||||
}
|
||||
}
|
||||
|
||||
void ScrollingList::AllocateSpritePoints()
|
||||
{
|
||||
if(!ScrollPoints) { return; }
|
||||
if(!SpriteList) { return; }
|
||||
if(SpriteList->size() == 0) { return; }
|
||||
if(!TweenPoints) { return; }
|
||||
|
||||
}
|
||||
|
||||
void ScrollingList::AllocateSpritePoints()
|
||||
{
|
||||
if(!ScrollPoints) { return; }
|
||||
if(!SpriteList) { return; }
|
||||
if(SpriteList->size() == 0) { return; }
|
||||
if(!TweenPoints) { return; }
|
||||
|
||||
unsigned int spriteIndex = FirstSpriteIndex;
|
||||
|
||||
for(unsigned int i = 0; i < ScrollPoints->size(); ++i)
|
||||
@ -147,10 +147,10 @@ void ScrollingList::AllocateSpritePoints()
|
||||
|
||||
CircularIncrement(spriteIndex, SpriteList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ScrollingList::DestroyItems()
|
||||
{
|
||||
void ScrollingList::DestroyItems()
|
||||
{
|
||||
if(!SpriteList) { return; }
|
||||
std::vector<ComponentItemBinding *>::iterator it = SpriteList->begin();
|
||||
|
||||
@ -176,7 +176,7 @@ void ScrollingList::DestroyItems()
|
||||
|
||||
delete SpriteList;
|
||||
SpriteList = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ScrollingList::SetPoints(std::vector<ViewInfo *> *scrollPoints, std::vector<TweenSet *> *tweenPoints)
|
||||
@ -316,16 +316,16 @@ void ScrollingList::FreeGraphicsMemory()
|
||||
}
|
||||
}
|
||||
|
||||
void ScrollingList::TriggerMenuEnterEvent()
|
||||
{
|
||||
Focus = true;
|
||||
NotifyAllRequested = true;
|
||||
|
||||
if(!ScrollPoints) { return; }
|
||||
if(!SpriteList) { return; }
|
||||
if(SpriteList->size() == 0 ) { return; }
|
||||
if(FirstSpriteIndex >= SpriteList->size()) { return; }
|
||||
|
||||
void ScrollingList::TriggerMenuEnterEvent()
|
||||
{
|
||||
Focus = true;
|
||||
NotifyAllRequested = 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)
|
||||
@ -340,18 +340,18 @@ void ScrollingList::TriggerMenuEnterEvent()
|
||||
|
||||
CircularIncrement(spriteIndex, SpriteList);
|
||||
}
|
||||
}
|
||||
|
||||
void ScrollingList::TriggerMenuExitEvent()
|
||||
{
|
||||
Focus = false;
|
||||
NotifyAllRequested = true;
|
||||
|
||||
if(!ScrollPoints) { return; }
|
||||
if(!SpriteList) { return; }
|
||||
if(SpriteList->size() == 0 ) { return; }
|
||||
if(FirstSpriteIndex >= SpriteList->size()) { return; }
|
||||
|
||||
}
|
||||
|
||||
void ScrollingList::TriggerMenuExitEvent()
|
||||
{
|
||||
Focus = false;
|
||||
NotifyAllRequested = 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)
|
||||
@ -366,7 +366,7 @@ void ScrollingList::TriggerMenuExitEvent()
|
||||
|
||||
CircularIncrement(spriteIndex, SpriteList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ScrollingList::Update(float dt)
|
||||
{
|
||||
@ -515,24 +515,24 @@ 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);
|
||||
|
||||
TweenSets *scrollTween = sets->GetTween("menuScroll");
|
||||
TweenSets::iterator it = scrollTween->begin();
|
||||
TweenAttributes *scrollTween = sets->GetTween("menuScroll");
|
||||
TweenAttributes::iterator it = scrollTween->begin();
|
||||
|
||||
while(it != scrollTween->end())
|
||||
{
|
||||
@ -566,7 +566,7 @@ void ScrollingList::ResetTweens(Component *c, TweenSet *sets, ViewInfo *currentV
|
||||
set->push_back(new Tween(TWEEN_PROPERTY_FONT_SIZE, EASE_INOUT_QUADRATIC, currentViewInfo->GetFontSize(), nextViewInfo->GetFontSize(), scrollTime));
|
||||
set->push_back(new Tween(TWEEN_PROPERTY_BACKGROUND_ALPHA, EASE_INOUT_QUADRATIC, currentViewInfo->GetBackgroundAlpha(), nextViewInfo->GetBackgroundAlpha(), scrollTime));
|
||||
scrollTween->push_back(set);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool ScrollingList::AllocateTexture(ComponentItemBinding *s)
|
||||
@ -796,17 +796,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)
|
||||
|
||||
@ -471,26 +471,26 @@ TweenSet *PageBuilder::CreateTweenInstance(xml_node<> *componentXml)
|
||||
{
|
||||
TweenSet *tweens = new TweenSet();
|
||||
|
||||
BuildTweenSets(tweens, componentXml, "onEnter", "enter");
|
||||
BuildTweenSets(tweens, componentXml, "onExit", "exit");
|
||||
BuildTweenSets(tweens, componentXml, "onIdle", "idle");
|
||||
BuildTweenSets(tweens, componentXml, "onHighlightEnter", "highlightEnter");
|
||||
BuildTweenSets(tweens, componentXml, "onHighlightExit", "highlightExit");
|
||||
BuildTweenSets(tweens, componentXml, "onMenuEnter", "menuEnter");
|
||||
BuildTweenSets(tweens, componentXml, "onMenuExit", "menuExit");
|
||||
BuildTweenAttributes(tweens, componentXml, "onEnter", "enter");
|
||||
BuildTweenAttributes(tweens, componentXml, "onExit", "exit");
|
||||
BuildTweenAttributes(tweens, componentXml, "onIdle", "idle");
|
||||
BuildTweenAttributes(tweens, componentXml, "onHighlightEnter", "highlightEnter");
|
||||
BuildTweenAttributes(tweens, componentXml, "onHighlightExit", "highlightExit");
|
||||
BuildTweenAttributes(tweens, componentXml, "onMenuEnter", "menuEnter");
|
||||
BuildTweenAttributes(tweens, componentXml, "onMenuExit", "menuExit");
|
||||
|
||||
return tweens;
|
||||
}
|
||||
|
||||
void PageBuilder::BuildTweenSets(TweenSet *tweens, xml_node<> *componentXml, std::string tagName, std::string tweenName)
|
||||
void PageBuilder::BuildTweenAttributes(TweenSet *tweens, xml_node<> *componentXml, std::string tagName, std::string tweenName)
|
||||
{
|
||||
for(componentXml = componentXml->first_node(tagName.c_str()); componentXml; componentXml = componentXml->next_sibling(tagName.c_str()))
|
||||
{
|
||||
xml_attribute<> *indexXml = componentXml->first_attribute("menuIndex");
|
||||
int index = (indexXml) ? Utils::ConvertInt(indexXml->value()) : -1;
|
||||
|
||||
TweenSet::TweenSets *sets = new TweenSet::TweenSets();
|
||||
GetTweenSets(componentXml, sets);
|
||||
TweenSet::TweenAttributes *sets = new TweenSet::TweenAttributes();
|
||||
GetTweenAttributes(componentXml, sets);
|
||||
tweens->SetTween(tweenName, index, sets);
|
||||
}
|
||||
}
|
||||
@ -810,7 +810,7 @@ void PageBuilder::BuildViewInfo(xml_node<> *componentXml, ViewInfo *info, xml_no
|
||||
}
|
||||
}
|
||||
|
||||
void PageBuilder::GetTweenSets(xml_node<> *node, std::vector<std::vector<Tween *> *> *tweenSets)
|
||||
void PageBuilder::GetTweenAttributes(xml_node<> *node, std::vector<std::vector<Tween *> *> *TweenAttributes)
|
||||
{
|
||||
if(node)
|
||||
{
|
||||
@ -818,7 +818,7 @@ void PageBuilder::GetTweenSets(xml_node<> *node, std::vector<std::vector<Tween *
|
||||
{
|
||||
std::vector<Tween *> *tweens = new std::vector<Tween *>();
|
||||
GetTweenSet(set, *tweens);
|
||||
tweenSets->push_back(tweens);
|
||||
TweenAttributes->push_back(tweens);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ private:
|
||||
bool BuildComponents(rapidxml::xml_node<> *layout, Page *page);
|
||||
void LoadTweens(Component *c, rapidxml::xml_node<> *componentXml);
|
||||
TweenSet *CreateTweenInstance(rapidxml::xml_node<> *componentXml);
|
||||
void BuildTweenSets(TweenSet *tweens, rapidxml::xml_node<> *componentXml, std::string tagName, std::string tweenName);
|
||||
void BuildTweenAttributes(TweenSet *tweens, rapidxml::xml_node<> *componentXml, std::string tagName, std::string tweenName);
|
||||
ScrollingList * BuildMenu(rapidxml::xml_node<> *menuXml);
|
||||
void BuildCustomMenu(ScrollingList *menu, rapidxml::xml_node<> *menuXml, rapidxml::xml_node<> *itemDefaults);
|
||||
void BuildVerticalMenu(ScrollingList *menu, rapidxml::xml_node<> *menuXml, rapidxml::xml_node<> *itemDefaults);
|
||||
@ -63,7 +63,7 @@ private:
|
||||
|
||||
rapidxml::xml_attribute<> *FindAttribute(rapidxml::xml_node<> *componentXml, std::string attribute, rapidxml::xml_node<> *defaultXml);
|
||||
|
||||
void GetTweenSets(rapidxml::xml_node<> *node, std::vector<std::vector<Tween *> *> *tweenSets);
|
||||
void GetTweenAttributes(rapidxml::xml_node<> *node, std::vector<std::vector<Tween *> *> *TweenAttributes);
|
||||
void GetTweenSet(rapidxml::xml_node<> *node, std::vector<Tween *> &tweens);
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user