mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2025-12-13 02:08:52 +01:00
Breaking tweens up into 4 classes for readability. Created copy constructors. ScrollingList copy constructor still causes crash when update is called.
This commit is contained in:
parent
1f8441a0ce
commit
af451bfa81
@ -86,7 +86,9 @@ set(RETROFE_HEADERS
|
|||||||
"${RETROFE_DIR}/Source/Execute/Launcher.h"
|
"${RETROFE_DIR}/Source/Execute/Launcher.h"
|
||||||
"${RETROFE_DIR}/Source/Graphics/Animate/Tween.h"
|
"${RETROFE_DIR}/Source/Graphics/Animate/Tween.h"
|
||||||
"${RETROFE_DIR}/Source/Graphics/Animate/TweenTypes.h"
|
"${RETROFE_DIR}/Source/Graphics/Animate/TweenTypes.h"
|
||||||
"${RETROFE_DIR}/Source/Graphics/Animate/TweenSets.h"
|
"${RETROFE_DIR}/Source/Graphics/Animate/TweenSet.h"
|
||||||
|
"${RETROFE_DIR}/Source/Graphics/Animate/Animation.h"
|
||||||
|
"${RETROFE_DIR}/Source/Graphics/Animate/AnimationEvents.h"
|
||||||
"${RETROFE_DIR}/Source/Graphics/ComponentItemBinding.h"
|
"${RETROFE_DIR}/Source/Graphics/ComponentItemBinding.h"
|
||||||
"${RETROFE_DIR}/Source/Graphics/Component/Container.h"
|
"${RETROFE_DIR}/Source/Graphics/Component/Container.h"
|
||||||
"${RETROFE_DIR}/Source/Graphics/Component/Component.h"
|
"${RETROFE_DIR}/Source/Graphics/Component/Component.h"
|
||||||
@ -132,8 +134,10 @@ set(RETROFE_SOURCES
|
|||||||
"${RETROFE_DIR}/Source/Graphics/PageBuilder.cpp"
|
"${RETROFE_DIR}/Source/Graphics/PageBuilder.cpp"
|
||||||
"${RETROFE_DIR}/Source/Graphics/Page.cpp"
|
"${RETROFE_DIR}/Source/Graphics/Page.cpp"
|
||||||
"${RETROFE_DIR}/Source/Graphics/ViewInfo.cpp"
|
"${RETROFE_DIR}/Source/Graphics/ViewInfo.cpp"
|
||||||
|
"${RETROFE_DIR}/Source/Graphics/Animate/Animation.cpp"
|
||||||
|
"${RETROFE_DIR}/Source/Graphics/Animate/AnimationEvents.cpp"
|
||||||
"${RETROFE_DIR}/Source/Graphics/Animate/Tween.cpp"
|
"${RETROFE_DIR}/Source/Graphics/Animate/Tween.cpp"
|
||||||
"${RETROFE_DIR}/Source/Graphics/Animate/TweenSets.cpp"
|
"${RETROFE_DIR}/Source/Graphics/Animate/TweenSet.cpp"
|
||||||
"${RETROFE_DIR}/Source/Graphics/ComponentItemBindingBuilder.cpp"
|
"${RETROFE_DIR}/Source/Graphics/ComponentItemBindingBuilder.cpp"
|
||||||
"${RETROFE_DIR}/Source/Graphics/ComponentItemBinding.cpp"
|
"${RETROFE_DIR}/Source/Graphics/ComponentItemBinding.cpp"
|
||||||
"${RETROFE_DIR}/Source/Graphics/Component/Container.cpp"
|
"${RETROFE_DIR}/Source/Graphics/Component/Container.cpp"
|
||||||
|
|||||||
68
RetroFE/Source/Graphics/Animate/Animation.cpp
Normal file
68
RetroFE/Source/Graphics/Animate/Animation.cpp
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
/* This file is part of RetroFE.
|
||||||
|
*
|
||||||
|
* RetroFE is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RetroFE is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with RetroFE. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "Animation.h"
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
Animation::Animation()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Animation::Animation(Animation ©)
|
||||||
|
{
|
||||||
|
for(std::vector<TweenSet *>::iterator it = copy.AnimationVector.begin(); it != copy.AnimationVector.end(); it++)
|
||||||
|
{
|
||||||
|
Push(new TweenSet(**it));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Animation::~Animation()
|
||||||
|
{
|
||||||
|
Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Animation::Push(TweenSet *set)
|
||||||
|
{
|
||||||
|
AnimationVector.push_back(set);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Animation::Clear()
|
||||||
|
{
|
||||||
|
std::vector<TweenSet *>::iterator it = AnimationVector.begin();
|
||||||
|
while(it != AnimationVector.end())
|
||||||
|
{
|
||||||
|
delete *it;
|
||||||
|
AnimationVector.erase(it);
|
||||||
|
it = AnimationVector.begin();
|
||||||
|
}
|
||||||
|
|
||||||
|
AnimationVector.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<TweenSet *> *Animation::GetTweenSets()
|
||||||
|
{
|
||||||
|
return &AnimationVector;
|
||||||
|
}
|
||||||
|
|
||||||
|
TweenSet *Animation::GetTweenSet(unsigned int index)
|
||||||
|
{
|
||||||
|
return AnimationVector[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
unsigned int Animation::GetSize()
|
||||||
|
{
|
||||||
|
return AnimationVector.size();
|
||||||
|
}
|
||||||
36
RetroFE/Source/Graphics/Animate/Animation.h
Normal file
36
RetroFE/Source/Graphics/Animate/Animation.h
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
/* This file is part of RetroFE.
|
||||||
|
*
|
||||||
|
* RetroFE is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RetroFE is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with RetroFE. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "TweenSet.h"
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
#include <map>
|
||||||
|
|
||||||
|
class Animation
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Animation();
|
||||||
|
Animation(Animation ©);
|
||||||
|
~Animation();
|
||||||
|
void Push(TweenSet *set);
|
||||||
|
void Clear();
|
||||||
|
std::vector<TweenSet *> *GetTweenSets();
|
||||||
|
TweenSet *GetTweenSet(unsigned int index);
|
||||||
|
unsigned int GetSize();
|
||||||
|
private:
|
||||||
|
std::vector<TweenSet *> AnimationVector;
|
||||||
|
};
|
||||||
95
RetroFE/Source/Graphics/Animate/AnimationEvents.cpp
Normal file
95
RetroFE/Source/Graphics/Animate/AnimationEvents.cpp
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
/* This file is part of RetroFE.
|
||||||
|
*
|
||||||
|
* RetroFE is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RetroFE is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with RetroFE. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "AnimationEvents.h"
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
AnimationEvents::AnimationEvents()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
AnimationEvents::AnimationEvents(AnimationEvents ©)
|
||||||
|
{
|
||||||
|
for(std::map<std::string, std::map<int , Animation *> >::iterator it = copy.AnimationMap.begin(); it != copy.AnimationMap.end(); it++)
|
||||||
|
{
|
||||||
|
for(std::map<int, Animation *>::iterator it2 = (it->second).begin(); it2 != (it->second).end(); it2++)
|
||||||
|
{
|
||||||
|
Animation *t = new Animation(*it2->second);
|
||||||
|
AnimationMap[it->first][it2->first] = t;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
AnimationEvents::~AnimationEvents()
|
||||||
|
{
|
||||||
|
Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
Animation *AnimationEvents::GetAnimation(std::string tween)
|
||||||
|
{
|
||||||
|
return GetAnimation(tween, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
Animation *AnimationEvents::GetAnimation(std::string tween, int index)
|
||||||
|
{
|
||||||
|
if(AnimationMap.find(tween) == AnimationMap.end())
|
||||||
|
{
|
||||||
|
AnimationMap[tween][-1] = new Animation();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(AnimationMap[tween].find(index) == AnimationMap[tween].end())
|
||||||
|
{
|
||||||
|
index = -1;
|
||||||
|
|
||||||
|
if(AnimationMap[tween].find(index) == AnimationMap[tween].end())
|
||||||
|
{
|
||||||
|
AnimationMap[tween][index] = new Animation();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return AnimationMap[tween][index];
|
||||||
|
}
|
||||||
|
|
||||||
|
void AnimationEvents::SetAnimation(std::string tween, int index, Animation *animation)
|
||||||
|
{
|
||||||
|
AnimationMap[tween][index] = animation;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AnimationEvents::Clear()
|
||||||
|
{
|
||||||
|
std::map<std::string, std::map<int, Animation *> >::iterator it = AnimationMap.begin();
|
||||||
|
while(it != AnimationMap.end())
|
||||||
|
{
|
||||||
|
std::map<int, Animation *>::iterator it2 = (it->second).begin();
|
||||||
|
while(it2 != (it->second).end())
|
||||||
|
{
|
||||||
|
delete it2->second;
|
||||||
|
(it->second).erase(it2);
|
||||||
|
}
|
||||||
|
|
||||||
|
(it->second).clear();
|
||||||
|
AnimationMap.erase(it);
|
||||||
|
it = AnimationMap.begin();
|
||||||
|
}
|
||||||
|
|
||||||
|
AnimationMap.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -16,25 +16,23 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Tween.h"
|
#include "Tween.h"
|
||||||
|
#include "Animation.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
class TweenSets
|
class AnimationEvents
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TweenSets();
|
AnimationEvents();
|
||||||
TweenSets(TweenSets ©);
|
AnimationEvents(AnimationEvents ©);
|
||||||
~TweenSets();
|
~AnimationEvents();
|
||||||
typedef std::vector<std::vector<Tween *> *> TweenAttributes;
|
|
||||||
|
|
||||||
TweenAttributes *GetTween(std::string tween);
|
Animation *GetAnimation(std::string tween);
|
||||||
TweenAttributes *GetTween(std::string tween, int index);
|
Animation *GetAnimation(std::string tween, int index);
|
||||||
void SetTween(std::string tween, int index, TweenAttributes *set);
|
void SetAnimation(std::string tween, int index, Animation *animation);
|
||||||
|
void Clear();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TweenAttributes *FindTween(std::map<int, TweenAttributes *> &tweens, int index);
|
std::map<std::string, std::map<int, Animation *> > AnimationMap;
|
||||||
void DestroyTweens();
|
|
||||||
|
|
||||||
std::map<std::string, std::map<int, TweenAttributes *> > TweenMap;
|
|
||||||
};
|
};
|
||||||
65
RetroFE/Source/Graphics/Animate/TweenSet.cpp
Normal file
65
RetroFE/Source/Graphics/Animate/TweenSet.cpp
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
/* This file is part of RetroFE.
|
||||||
|
*
|
||||||
|
* RetroFE is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RetroFE is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with RetroFE. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#include "TweenSet.h"
|
||||||
|
|
||||||
|
TweenSet::TweenSet()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
TweenSet::TweenSet(TweenSet ©)
|
||||||
|
{
|
||||||
|
for(std::vector<Tween *>::iterator it = copy.Set.begin(); it != copy.Set.end(); it++)
|
||||||
|
{
|
||||||
|
Tween *t = new Tween(**it);
|
||||||
|
Set.push_back(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TweenSet::~TweenSet()
|
||||||
|
{
|
||||||
|
Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TweenSet::Push(Tween *tween)
|
||||||
|
{
|
||||||
|
Set.push_back(tween);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TweenSet::Clear()
|
||||||
|
{
|
||||||
|
std::vector<Tween *>::iterator it = Set.begin();
|
||||||
|
while(it != Set.end())
|
||||||
|
{
|
||||||
|
delete *it;
|
||||||
|
Set.erase(it);
|
||||||
|
it = Set.begin();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
std::vector<Tween *> *TweenSet::GetTweens()
|
||||||
|
{
|
||||||
|
return &Set;
|
||||||
|
}
|
||||||
|
|
||||||
|
Tween *TweenSet::GetTween(unsigned int index)
|
||||||
|
{
|
||||||
|
return Set[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
unsigned int TweenSet::GetSize()
|
||||||
|
{
|
||||||
|
return Set.size();
|
||||||
|
}
|
||||||
35
RetroFE/Source/Graphics/Animate/TweenSet.h
Normal file
35
RetroFE/Source/Graphics/Animate/TweenSet.h
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
/* This file is part of RetroFE.
|
||||||
|
*
|
||||||
|
* RetroFE is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RetroFE is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with RetroFE. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Tween.h"
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
class TweenSet
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
TweenSet();
|
||||||
|
TweenSet(TweenSet ©);
|
||||||
|
~TweenSet();
|
||||||
|
void Push(Tween * tween);
|
||||||
|
void Clear();
|
||||||
|
std::vector<Tween *> *GetTweens();
|
||||||
|
Tween *GetTween(unsigned int index);
|
||||||
|
unsigned int GetSize();
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::vector<Tween *> Set;
|
||||||
|
};
|
||||||
@ -1,93 +0,0 @@
|
|||||||
/* This file is part of RetroFE.
|
|
||||||
*
|
|
||||||
* RetroFE is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* RetroFE is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with RetroFE. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "TweenSets.h"
|
|
||||||
|
|
||||||
TweenSets::TweenSets()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
TweenSets::TweenSets(TweenSets ©)
|
|
||||||
{
|
|
||||||
std::map<std::string, std::map<int, TweenAttributes *> >::iterator it;
|
|
||||||
|
|
||||||
for(it = copy.TweenMap.begin(); it != copy.TweenMap.end(); it++)
|
|
||||||
{
|
|
||||||
std::map<int, TweenAttributes *>::iterator it2;
|
|
||||||
|
|
||||||
for(it2 = (it->second).begin(); it2 != (it->second).end(); it2++)
|
|
||||||
{
|
|
||||||
TweenMap[it->first][it2->first] = it2->second;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
TweenSets::~TweenSets()
|
|
||||||
{
|
|
||||||
DestroyTweens();
|
|
||||||
}
|
|
||||||
|
|
||||||
void TweenSets::DestroyTweens()
|
|
||||||
{
|
|
||||||
std::map<std::string, std::map<int, TweenAttributes *> >::iterator it = TweenMap.begin();
|
|
||||||
|
|
||||||
while(it != TweenMap.end())
|
|
||||||
{
|
|
||||||
std::map<int, TweenAttributes *>::iterator it2 = (it->second).begin();
|
|
||||||
|
|
||||||
while(it2 != (it->second).end())
|
|
||||||
{
|
|
||||||
delete it2->second;
|
|
||||||
(it->second).erase(it2);
|
|
||||||
it2 = (it->second).begin();
|
|
||||||
}
|
|
||||||
|
|
||||||
it =TweenMap.begin();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TweenSets::TweenAttributes *TweenSets::GetTween(std::string tween)
|
|
||||||
{
|
|
||||||
return GetTween(tween, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
TweenSets::TweenAttributes *TweenSets::GetTween(std::string tween, int index)
|
|
||||||
{
|
|
||||||
return FindTween(TweenMap[tween], index);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TweenSets::SetTween(std::string tween, int index, TweenAttributes *set)
|
|
||||||
{
|
|
||||||
TweenMap[tween][index] = set;
|
|
||||||
}
|
|
||||||
|
|
||||||
TweenSets::TweenAttributes *TweenSets::FindTween(std::map<int, TweenAttributes *> &tweens, int index)
|
|
||||||
{
|
|
||||||
if(tweens.find(index) == tweens.end())
|
|
||||||
{
|
|
||||||
index = -1;
|
|
||||||
|
|
||||||
if(tweens.find(index) == tweens.end())
|
|
||||||
{
|
|
||||||
TweenAttributes *set = new TweenAttributes();
|
|
||||||
tweens[index] = set;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return tweens[index];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@ -29,6 +29,23 @@ Component::Component()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Component::Component(const Component ©)
|
||||||
|
{
|
||||||
|
Tweens = NULL;
|
||||||
|
SelectedItem = NULL;
|
||||||
|
NewItemSelectedSinceEnter = false;
|
||||||
|
BackgroundTexture = NULL;
|
||||||
|
FreeGraphicsMemory();
|
||||||
|
|
||||||
|
if(copy.Tweens)
|
||||||
|
{
|
||||||
|
AnimationEvents *tweens = new AnimationEvents(*copy.Tweens);
|
||||||
|
SetTweens(tweens);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
Component::~Component()
|
Component::~Component()
|
||||||
{
|
{
|
||||||
FreeGraphicsMemory();
|
FreeGraphicsMemory();
|
||||||
@ -151,18 +168,24 @@ void Component::SetCollectionName(std::string collectionName)
|
|||||||
CollectionName = collectionName;
|
CollectionName = collectionName;
|
||||||
}
|
}
|
||||||
|
|
||||||
TweenSets *Component::GetTweens()
|
AnimationEvents *Component::GetTweens()
|
||||||
{
|
{
|
||||||
return Tweens;
|
return Tweens;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Component::SetTweens(TweenSets *set)
|
void Component::SetTweens(AnimationEvents *set)
|
||||||
{
|
{
|
||||||
Tweens = set;
|
Tweens = set;
|
||||||
|
ForceIdle();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Component::ForceIdle()
|
||||||
|
{
|
||||||
CurrentAnimationState = IDLE;
|
CurrentAnimationState = IDLE;
|
||||||
CurrentTweenIndex = 0;
|
CurrentTweenIndex = 0;
|
||||||
CurrentTweenComplete = false;
|
CurrentTweenComplete = false;
|
||||||
ElapsedTweenTime = 0;
|
ElapsedTweenTime = 0;
|
||||||
|
CurrentTweens = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ViewInfo *Component::GetBaseViewInfo()
|
ViewInfo *Component::GetBaseViewInfo()
|
||||||
@ -219,7 +242,7 @@ void Component::Update(float dt)
|
|||||||
|
|
||||||
|
|
||||||
case ENTER:
|
case ENTER:
|
||||||
CurrentTweens = Tweens->GetTween("enter", MenuEnterIndex);
|
CurrentTweens = Tweens->GetAnimation("enter", MenuEnterIndex);
|
||||||
CurrentAnimationState = HIGHLIGHT_ENTER;
|
CurrentAnimationState = HIGHLIGHT_ENTER;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -229,7 +252,7 @@ void Component::Update(float dt)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case HIGHLIGHT_ENTER:
|
case HIGHLIGHT_ENTER:
|
||||||
CurrentTweens = Tweens->GetTween("idle", MenuEnterIndex);
|
CurrentTweens = Tweens->GetAnimation("idle", MenuEnterIndex);
|
||||||
CurrentAnimationState = IDLE;
|
CurrentAnimationState = IDLE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -242,13 +265,13 @@ void Component::Update(float dt)
|
|||||||
}
|
}
|
||||||
else if(MenuExitRequested && (!MenuEnterRequested || MenuExitRequested <= MenuEnterRequested))
|
else if(MenuExitRequested && (!MenuEnterRequested || MenuExitRequested <= MenuEnterRequested))
|
||||||
{
|
{
|
||||||
CurrentTweens = Tweens->GetTween("menuExit", MenuExitIndex);
|
CurrentTweens = Tweens->GetAnimation("menuExit", MenuExitIndex);
|
||||||
CurrentAnimationState = MENU_EXIT;
|
CurrentAnimationState = MENU_EXIT;
|
||||||
MenuExitRequested = false;
|
MenuExitRequested = false;
|
||||||
}
|
}
|
||||||
else if(MenuEnterRequested && (!MenuExitRequested || MenuExitRequested > MenuEnterRequested))
|
else if(MenuEnterRequested && (!MenuExitRequested || MenuExitRequested > MenuEnterRequested))
|
||||||
{
|
{
|
||||||
CurrentTweens = Tweens->GetTween("menuEnter", MenuEnterIndex);
|
CurrentTweens = Tweens->GetAnimation("menuEnter", MenuEnterIndex);
|
||||||
CurrentAnimationState = MENU_ENTER;
|
CurrentAnimationState = MENU_ENTER;
|
||||||
MenuEnterRequested = false;
|
MenuEnterRequested = false;
|
||||||
|
|
||||||
@ -256,17 +279,17 @@ void Component::Update(float dt)
|
|||||||
else if(MenuScrollRequested)
|
else if(MenuScrollRequested)
|
||||||
{
|
{
|
||||||
MenuScrollRequested = false;
|
MenuScrollRequested = false;
|
||||||
CurrentTweens = Tweens->GetTween("menuScroll", MenuEnterIndex);
|
CurrentTweens = Tweens->GetAnimation("menuScroll", MenuEnterIndex);
|
||||||
CurrentAnimationState = MENU_SCROLL;
|
CurrentAnimationState = MENU_SCROLL;
|
||||||
}
|
}
|
||||||
else if(IsScrollActive() || NewItemSelected || ExitRequested)
|
else if(IsScrollActive() || NewItemSelected || ExitRequested)
|
||||||
{
|
{
|
||||||
CurrentTweens = Tweens->GetTween("highlightExit", MenuEnterIndex);
|
CurrentTweens = Tweens->GetAnimation("highlightExit", MenuEnterIndex);
|
||||||
CurrentAnimationState = HIGHLIGHT_EXIT;
|
CurrentAnimationState = HIGHLIGHT_EXIT;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CurrentTweens = Tweens->GetTween("idle", MenuEnterIndex);
|
CurrentTweens = Tweens->GetAnimation("idle", MenuEnterIndex);
|
||||||
CurrentAnimationState = IDLE;
|
CurrentAnimationState = IDLE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -278,14 +301,14 @@ void Component::Update(float dt)
|
|||||||
|
|
||||||
if(ExitRequested && (CurrentAnimationState == HIGHLIGHT_WAIT))
|
if(ExitRequested && (CurrentAnimationState == HIGHLIGHT_WAIT))
|
||||||
{
|
{
|
||||||
CurrentTweens = Tweens->GetTween("highlightExit", MenuEnterIndex);
|
CurrentTweens = Tweens->GetAnimation("highlightExit", MenuEnterIndex);
|
||||||
CurrentAnimationState = HIGHLIGHT_EXIT;
|
CurrentAnimationState = HIGHLIGHT_EXIT;
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(ExitRequested && (CurrentAnimationState == HIGHLIGHT_EXIT))
|
else if(ExitRequested && (CurrentAnimationState == HIGHLIGHT_EXIT))
|
||||||
{
|
{
|
||||||
|
|
||||||
CurrentTweens = Tweens->GetTween("exit", MenuEnterIndex);
|
CurrentTweens = Tweens->GetAnimation("exit", MenuEnterIndex);
|
||||||
CurrentAnimationState = EXIT;
|
CurrentAnimationState = EXIT;
|
||||||
ExitRequested = false;
|
ExitRequested = false;
|
||||||
}
|
}
|
||||||
@ -296,7 +319,7 @@ void Component::Update(float dt)
|
|||||||
}
|
}
|
||||||
else if(NewItemSelected)
|
else if(NewItemSelected)
|
||||||
{
|
{
|
||||||
CurrentTweens = Tweens->GetTween("highlightEnter", MenuEnterIndex);
|
CurrentTweens = Tweens->GetAnimation("highlightEnter", MenuEnterIndex);
|
||||||
CurrentAnimationState = HIGHLIGHT_ENTER;
|
CurrentAnimationState = HIGHLIGHT_ENTER;
|
||||||
HighlightExitComplete = true;
|
HighlightExitComplete = true;
|
||||||
NewItemSelected = false;
|
NewItemSelected = false;
|
||||||
@ -311,19 +334,19 @@ void Component::Update(float dt)
|
|||||||
case HIDDEN:
|
case HIDDEN:
|
||||||
if(EnterRequested || ExitRequested)
|
if(EnterRequested || ExitRequested)
|
||||||
{
|
{
|
||||||
CurrentTweens = Tweens->GetTween("enter", MenuEnterIndex);
|
CurrentTweens = Tweens->GetAnimation("enter", MenuEnterIndex);
|
||||||
CurrentAnimationState = ENTER;
|
CurrentAnimationState = ENTER;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if(MenuExitRequested && (!MenuEnterRequested || MenuExitRequested <= MenuEnterRequested))
|
else if(MenuExitRequested && (!MenuEnterRequested || MenuExitRequested <= MenuEnterRequested))
|
||||||
{
|
{
|
||||||
CurrentTweens = Tweens->GetTween("menuExit", MenuExitIndex);
|
CurrentTweens = Tweens->GetAnimation("menuExit", MenuExitIndex);
|
||||||
CurrentAnimationState = MENU_EXIT;
|
CurrentAnimationState = MENU_EXIT;
|
||||||
MenuExitRequested = false;
|
MenuExitRequested = false;
|
||||||
}
|
}
|
||||||
else if(MenuEnterRequested && (!MenuExitRequested || MenuExitRequested > MenuEnterRequested))
|
else if(MenuEnterRequested && (!MenuExitRequested || MenuExitRequested > MenuEnterRequested))
|
||||||
{
|
{
|
||||||
CurrentTweens = Tweens->GetTween("menuEnter", MenuEnterIndex);
|
CurrentTweens = Tweens->GetAnimation("menuEnter", MenuEnterIndex);
|
||||||
CurrentAnimationState = MENU_ENTER;
|
CurrentAnimationState = MENU_ENTER;
|
||||||
MenuEnterRequested = false;
|
MenuEnterRequested = false;
|
||||||
|
|
||||||
@ -331,7 +354,7 @@ void Component::Update(float dt)
|
|||||||
else if(MenuScrollRequested)
|
else if(MenuScrollRequested)
|
||||||
{
|
{
|
||||||
MenuScrollRequested = false;
|
MenuScrollRequested = false;
|
||||||
CurrentTweens = Tweens->GetTween("menuScroll", MenuEnterIndex);
|
CurrentTweens = Tweens->GetAnimation("menuScroll", MenuEnterIndex);
|
||||||
CurrentAnimationState = MENU_SCROLL;
|
CurrentAnimationState = MENU_SCROLL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -375,18 +398,18 @@ void Component::Draw()
|
|||||||
bool Component::Animate(bool loop)
|
bool Component::Animate(bool loop)
|
||||||
{
|
{
|
||||||
bool completeDone = false;
|
bool completeDone = false;
|
||||||
if(!CurrentTweens || CurrentTweenIndex >= CurrentTweens->size())
|
if(!CurrentTweens || CurrentTweenIndex >= CurrentTweens->GetSize())
|
||||||
{
|
{
|
||||||
completeDone = true;
|
completeDone = true;
|
||||||
}
|
}
|
||||||
else if(CurrentTweens)
|
else if(CurrentTweens)
|
||||||
{
|
{
|
||||||
bool currentDone = true;
|
bool currentDone = true;
|
||||||
std::vector<Tween *> *TweenSets = CurrentTweens->at(CurrentTweenIndex);
|
TweenSet *tweens = CurrentTweens->GetTweenSet(CurrentTweenIndex);
|
||||||
|
|
||||||
for(unsigned int i = 0; i < TweenSets->size(); i++)
|
for(unsigned int i = 0; i < tweens->GetSize(); i++)
|
||||||
{
|
{
|
||||||
Tween *tween = TweenSets->at(i);
|
Tween *tween = tweens->GetTweens()->at(i);
|
||||||
float elapsedTime = ElapsedTweenTime;
|
float elapsedTime = ElapsedTweenTime;
|
||||||
|
|
||||||
//todo: too many levels of nesting
|
//todo: too many levels of nesting
|
||||||
@ -460,7 +483,7 @@ bool Component::Animate(bool loop)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!CurrentTweens || CurrentTweenIndex >= CurrentTweens->size())
|
if(!CurrentTweens || CurrentTweenIndex >= CurrentTweens->GetTweenSets()->size())
|
||||||
{
|
{
|
||||||
if(loop)
|
if(loop)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -21,13 +21,14 @@
|
|||||||
#include "../MenuNotifierInterface.h"
|
#include "../MenuNotifierInterface.h"
|
||||||
#include "../ViewInfo.h"
|
#include "../ViewInfo.h"
|
||||||
#include "../Animate/Tween.h"
|
#include "../Animate/Tween.h"
|
||||||
#include "../Animate/TweenSets.h"
|
#include "../Animate/AnimationEvents.h"
|
||||||
#include "../../Collection/Item.h"
|
#include "../../Collection/Item.h"
|
||||||
|
|
||||||
class Component
|
class Component
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Component();
|
Component();
|
||||||
|
Component(const Component ©);
|
||||||
virtual ~Component();
|
virtual ~Component();
|
||||||
virtual void FreeGraphicsMemory();
|
virtual void FreeGraphicsMemory();
|
||||||
virtual void AllocateGraphicsMemory();
|
virtual void AllocateGraphicsMemory();
|
||||||
@ -48,8 +49,9 @@ public:
|
|||||||
|
|
||||||
virtual void Update(float dt);
|
virtual void Update(float dt);
|
||||||
virtual void Draw();
|
virtual void Draw();
|
||||||
TweenSets *GetTweens();
|
AnimationEvents *GetTweens();
|
||||||
void SetTweens(TweenSets *set);
|
void SetTweens(AnimationEvents *set);
|
||||||
|
void ForceIdle();
|
||||||
ViewInfo *GetBaseViewInfo();
|
ViewInfo *GetBaseViewInfo();
|
||||||
void UpdateBaseViewInfo(ViewInfo &info);
|
void UpdateBaseViewInfo(ViewInfo &info);
|
||||||
bool IsScrollActive() const;
|
bool IsScrollActive() const;
|
||||||
@ -87,8 +89,8 @@ private:
|
|||||||
bool Animate(bool loop);
|
bool Animate(bool loop);
|
||||||
bool IsTweenSequencingComplete();
|
bool IsTweenSequencingComplete();
|
||||||
|
|
||||||
TweenSets *Tweens;
|
AnimationEvents *Tweens;
|
||||||
TweenSets::TweenAttributes *CurrentTweens;
|
Animation *CurrentTweens;
|
||||||
Item *SelectedItem;
|
Item *SelectedItem;
|
||||||
SDL_Texture *BackgroundTexture;
|
SDL_Texture *BackgroundTexture;
|
||||||
|
|
||||||
|
|||||||
@ -15,6 +15,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../Animate/Tween.h"
|
#include "../Animate/Tween.h"
|
||||||
|
#include "../Animate/TweenSet.h"
|
||||||
|
#include "../Animate/Animation.h"
|
||||||
|
#include "../Animate/AnimationEvents.h"
|
||||||
#include "../Animate/TweenTypes.h"
|
#include "../Animate/TweenTypes.h"
|
||||||
#include "../ComponentItemBinding.h"
|
#include "../ComponentItemBinding.h"
|
||||||
#include "../Font.h"
|
#include "../Font.h"
|
||||||
@ -44,6 +47,7 @@ ScrollingList::ScrollingList(Configuration &c,
|
|||||||
std::string imageType)
|
std::string imageType)
|
||||||
: SpriteList(NULL)
|
: SpriteList(NULL)
|
||||||
, ScrollPoints(NULL)
|
, ScrollPoints(NULL)
|
||||||
|
, TweenPoints(NULL)
|
||||||
, TweenEnterTime(0)
|
, TweenEnterTime(0)
|
||||||
, FirstSpriteIndex(0)
|
, FirstSpriteIndex(0)
|
||||||
, SelectedSpriteListIndex(0)
|
, SelectedSpriteListIndex(0)
|
||||||
@ -62,11 +66,61 @@ ScrollingList::ScrollingList(Configuration &c,
|
|||||||
, FontColor(fontColor)
|
, FontColor(fontColor)
|
||||||
, LayoutKey(layoutKey)
|
, LayoutKey(layoutKey)
|
||||||
, ImageType(imageType)
|
, ImageType(imageType)
|
||||||
, MaxLayer(0)
|
|
||||||
, Focus(false)
|
, Focus(false)
|
||||||
{
|
{
|
||||||
|
Component::Component();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ScrollingList::ScrollingList(const ScrollingList ©)
|
||||||
|
: SpriteList(NULL)
|
||||||
|
, TweenEnterTime(0)
|
||||||
|
, FirstSpriteIndex(0)
|
||||||
|
, SelectedSpriteListIndex(0)
|
||||||
|
, ScrollStopRequested(true)
|
||||||
|
, NotifyAllRequested(false)
|
||||||
|
, CurrentScrollDirection(ScrollDirectionIdle)
|
||||||
|
, RequestedScrollDirection(ScrollDirectionIdle)
|
||||||
|
, CurrentScrollState(ScrollStateIdle)
|
||||||
|
, ScrollAcceleration(copy.ScrollAcceleration)
|
||||||
|
, StartScrollTime(copy.StartScrollTime)
|
||||||
|
, ScrollPeriod(0)
|
||||||
|
, Config(copy.Config)
|
||||||
|
, ScaleX(copy.ScaleX)
|
||||||
|
, ScaleY(copy.ScaleY)
|
||||||
|
, FontInst(copy.FontInst)
|
||||||
|
, FontColor(copy.FontColor)
|
||||||
|
, LayoutKey(copy.LayoutKey)
|
||||||
|
, ImageType(copy.ImageType)
|
||||||
|
, Focus(false)
|
||||||
|
{
|
||||||
|
|
||||||
|
ScrollPoints = NULL;
|
||||||
|
TweenPoints = NULL;
|
||||||
|
|
||||||
|
if(copy.ScrollPoints)
|
||||||
|
{
|
||||||
|
ScrollPoints = new std::vector<ViewInfo *>();
|
||||||
|
for(unsigned int i = 0; i < copy.ScrollPoints->size(); ++i)
|
||||||
|
{
|
||||||
|
ViewInfo *v = new ViewInfo(*copy.ScrollPoints->at(i));
|
||||||
|
ScrollPoints->push_back(v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(copy.TweenPoints)
|
||||||
|
{
|
||||||
|
TweenPoints = new std::vector<AnimationEvents *>();
|
||||||
|
for(unsigned int i = 0; i < copy.TweenPoints->size(); ++i)
|
||||||
|
{
|
||||||
|
AnimationEvents *v = new AnimationEvents(*copy.TweenPoints->at(i));
|
||||||
|
TweenPoints->push_back(v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Component::Component(copy);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ScrollingList::~ScrollingList()
|
ScrollingList::~ScrollingList()
|
||||||
{
|
{
|
||||||
DestroyItems();
|
DestroyItems();
|
||||||
@ -200,16 +254,10 @@ void ScrollingList::DestroyItems()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ScrollingList::SetPoints(std::vector<ViewInfo *> *scrollPoints, std::vector<TweenSets *> *tweenPoints)
|
void ScrollingList::SetPoints(std::vector<ViewInfo *> *scrollPoints, std::vector<AnimationEvents *> *tweenPoints)
|
||||||
{
|
{
|
||||||
ScrollPoints = scrollPoints;
|
ScrollPoints = scrollPoints;
|
||||||
TweenPoints = tweenPoints;
|
TweenPoints = tweenPoints;
|
||||||
|
|
||||||
for(unsigned int i = 0; i != scrollPoints->size(); ++i)
|
|
||||||
{
|
|
||||||
ViewInfo *info = scrollPoints->at(i);
|
|
||||||
MaxLayer = (MaxLayer < info->GetLayer()) ? MaxLayer : info->GetLayer();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScrollingList::SetSelectedIndex(int selectedIndex)
|
void ScrollingList::SetSelectedIndex(int selectedIndex)
|
||||||
@ -575,7 +623,7 @@ void ScrollingList::UpdateSprite(unsigned int spriteIndex, unsigned int pointInd
|
|||||||
CircularIncrement(spriteIndex, SpriteList);
|
CircularIncrement(spriteIndex, SpriteList);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScrollingList::ResetTweens(Component *c, TweenSets *sets, ViewInfo *currentViewInfo, ViewInfo *nextViewInfo, double scrollTime)
|
void ScrollingList::ResetTweens(Component *c, AnimationEvents *sets, ViewInfo *currentViewInfo, ViewInfo *nextViewInfo, double scrollTime)
|
||||||
{
|
{
|
||||||
if(!c)
|
if(!c)
|
||||||
{
|
{
|
||||||
@ -603,41 +651,24 @@ void ScrollingList::ResetTweens(Component *c, TweenSets *sets, ViewInfo *current
|
|||||||
//todo: delete properly, memory leak (big), proof of concept
|
//todo: delete properly, memory leak (big), proof of concept
|
||||||
c->SetTweens(sets);
|
c->SetTweens(sets);
|
||||||
|
|
||||||
TweenSets::TweenAttributes *scrollTween = sets->GetTween("menuScroll");
|
Animation *scrollTween = sets->GetAnimation("menuScroll");
|
||||||
TweenSets::TweenAttributes::iterator it = scrollTween->begin();
|
scrollTween->Clear();
|
||||||
|
|
||||||
while(it != scrollTween->end())
|
|
||||||
{
|
|
||||||
std::vector<Tween *>::iterator it2 = (*it)->begin();
|
|
||||||
while(it2 != (*it)->end())
|
|
||||||
{
|
|
||||||
delete *it2;
|
|
||||||
(*it)->erase(it2);
|
|
||||||
it2 = (*it)->begin();
|
|
||||||
}
|
|
||||||
delete *it;
|
|
||||||
scrollTween->erase(it);
|
|
||||||
it = scrollTween->begin();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
scrollTween->clear();
|
|
||||||
c->UpdateBaseViewInfo(*currentViewInfo);
|
c->UpdateBaseViewInfo(*currentViewInfo);
|
||||||
|
|
||||||
std::vector<Tween *> *set = new std::vector<Tween *>();
|
TweenSet *set = new TweenSet();
|
||||||
set->push_back(new Tween(TWEEN_PROPERTY_HEIGHT, EASE_INOUT_QUADRATIC, currentViewInfo->GetHeight(), nextViewInfo->GetHeight(), scrollTime));
|
set->Push(new Tween(TWEEN_PROPERTY_HEIGHT, EASE_INOUT_QUADRATIC, currentViewInfo->GetHeight(), nextViewInfo->GetHeight(), scrollTime));
|
||||||
set->push_back(new Tween(TWEEN_PROPERTY_WIDTH, EASE_INOUT_QUADRATIC, currentViewInfo->GetWidth(), nextViewInfo->GetWidth(), scrollTime));
|
set->Push(new Tween(TWEEN_PROPERTY_WIDTH, EASE_INOUT_QUADRATIC, currentViewInfo->GetWidth(), nextViewInfo->GetWidth(), scrollTime));
|
||||||
set->push_back(new Tween(TWEEN_PROPERTY_ANGLE, EASE_INOUT_QUADRATIC, currentViewInfo->GetAngle(), nextViewInfo->GetAngle(), scrollTime));
|
set->Push(new Tween(TWEEN_PROPERTY_ANGLE, EASE_INOUT_QUADRATIC, currentViewInfo->GetAngle(), nextViewInfo->GetAngle(), scrollTime));
|
||||||
set->push_back(new Tween(TWEEN_PROPERTY_ALPHA, EASE_INOUT_QUADRATIC, currentViewInfo->GetAlpha(), nextViewInfo->GetAlpha(), scrollTime));
|
set->Push(new Tween(TWEEN_PROPERTY_ALPHA, EASE_INOUT_QUADRATIC, currentViewInfo->GetAlpha(), nextViewInfo->GetAlpha(), scrollTime));
|
||||||
set->push_back(new Tween(TWEEN_PROPERTY_X, EASE_INOUT_QUADRATIC, currentViewInfo->GetX(), nextViewInfo->GetX(), scrollTime));
|
set->Push(new Tween(TWEEN_PROPERTY_X, EASE_INOUT_QUADRATIC, currentViewInfo->GetX(), nextViewInfo->GetX(), scrollTime));
|
||||||
set->push_back(new Tween(TWEEN_PROPERTY_Y, EASE_INOUT_QUADRATIC, currentViewInfo->GetY(), nextViewInfo->GetY(), scrollTime));
|
set->Push(new Tween(TWEEN_PROPERTY_Y, EASE_INOUT_QUADRATIC, currentViewInfo->GetY(), nextViewInfo->GetY(), scrollTime));
|
||||||
set->push_back(new Tween(TWEEN_PROPERTY_X_ORIGIN, EASE_INOUT_QUADRATIC, currentViewInfo->GetXOrigin(), nextViewInfo->GetXOrigin(), scrollTime));
|
set->Push(new Tween(TWEEN_PROPERTY_X_ORIGIN, EASE_INOUT_QUADRATIC, currentViewInfo->GetXOrigin(), nextViewInfo->GetXOrigin(), scrollTime));
|
||||||
set->push_back(new Tween(TWEEN_PROPERTY_Y_ORIGIN, EASE_INOUT_QUADRATIC, currentViewInfo->GetYOrigin(), nextViewInfo->GetYOrigin(), scrollTime));
|
set->Push(new Tween(TWEEN_PROPERTY_Y_ORIGIN, EASE_INOUT_QUADRATIC, currentViewInfo->GetYOrigin(), nextViewInfo->GetYOrigin(), scrollTime));
|
||||||
set->push_back(new Tween(TWEEN_PROPERTY_X_OFFSET, EASE_INOUT_QUADRATIC, currentViewInfo->GetXOffset(), nextViewInfo->GetXOffset(), scrollTime));
|
set->Push(new Tween(TWEEN_PROPERTY_X_OFFSET, EASE_INOUT_QUADRATIC, currentViewInfo->GetXOffset(), nextViewInfo->GetXOffset(), scrollTime));
|
||||||
set->push_back(new Tween(TWEEN_PROPERTY_Y_OFFSET, EASE_INOUT_QUADRATIC, currentViewInfo->GetYOffset(), nextViewInfo->GetYOffset(), scrollTime));
|
set->Push(new Tween(TWEEN_PROPERTY_Y_OFFSET, EASE_INOUT_QUADRATIC, currentViewInfo->GetYOffset(), nextViewInfo->GetYOffset(), scrollTime));
|
||||||
set->push_back(new Tween(TWEEN_PROPERTY_FONT_SIZE, EASE_INOUT_QUADRATIC, currentViewInfo->GetFontSize(), nextViewInfo->GetFontSize(), scrollTime));
|
set->Push(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));
|
set->Push(new Tween(TWEEN_PROPERTY_BACKGROUND_ALPHA, EASE_INOUT_QUADRATIC, currentViewInfo->GetBackgroundAlpha(), nextViewInfo->GetBackgroundAlpha(), scrollTime));
|
||||||
scrollTween->push_back(set);
|
scrollTween->Push(set);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -50,6 +50,8 @@ public:
|
|||||||
SDL_Color fontColor,
|
SDL_Color fontColor,
|
||||||
std::string layoutKey,
|
std::string layoutKey,
|
||||||
std::string imageType);
|
std::string imageType);
|
||||||
|
|
||||||
|
ScrollingList(const ScrollingList ©);
|
||||||
virtual ~ScrollingList();
|
virtual ~ScrollingList();
|
||||||
void TriggerMenuEnterEvent();
|
void TriggerMenuEnterEvent();
|
||||||
void TriggerMenuExitEvent();
|
void TriggerMenuExitEvent();
|
||||||
@ -58,7 +60,7 @@ public:
|
|||||||
void DeallocateTexture(ComponentItemBinding *s);
|
void DeallocateTexture(ComponentItemBinding *s);
|
||||||
void SetItems(std::vector<ComponentItemBinding *> *spriteList);
|
void SetItems(std::vector<ComponentItemBinding *> *spriteList);
|
||||||
void DestroyItems();
|
void DestroyItems();
|
||||||
void SetPoints(std::vector<ViewInfo *> *scrollPoints, std::vector<TweenSets *> *tweenPoints);
|
void SetPoints(std::vector<ViewInfo *> *scrollPoints, std::vector<AnimationEvents *> *tweenPoints);
|
||||||
void SetScrollDirection(ScrollDirection direction);
|
void SetScrollDirection(ScrollDirection direction);
|
||||||
void PageUp();
|
void PageUp();
|
||||||
void PageDown();
|
void PageDown();
|
||||||
@ -84,7 +86,7 @@ private:
|
|||||||
void AllocateSpritePoints();
|
void AllocateSpritePoints();
|
||||||
void UpdateSprite(unsigned int spriteIndex, unsigned int pointIndex, bool newScroll, float dt, double nextScrollTime);
|
void UpdateSprite(unsigned int spriteIndex, unsigned int pointIndex, bool newScroll, float dt, double nextScrollTime);
|
||||||
unsigned int GetNextTween(unsigned int currentIndex, std::vector<ViewInfo *> *list);
|
unsigned int GetNextTween(unsigned int currentIndex, std::vector<ViewInfo *> *list);
|
||||||
void ResetTweens(Component *c, TweenSets *sets, ViewInfo *currentViewInfo, ViewInfo *nextViewInfo, double scrollTime);
|
void ResetTweens(Component *c, AnimationEvents *sets, ViewInfo *currentViewInfo, ViewInfo *nextViewInfo, double scrollTime);
|
||||||
|
|
||||||
enum ScrollState
|
enum ScrollState
|
||||||
{
|
{
|
||||||
@ -96,7 +98,7 @@ private:
|
|||||||
|
|
||||||
std::vector<ComponentItemBinding *> *SpriteList;
|
std::vector<ComponentItemBinding *> *SpriteList;
|
||||||
std::vector<ViewInfo *> *ScrollPoints;
|
std::vector<ViewInfo *> *ScrollPoints;
|
||||||
std::vector<TweenSets *> *TweenPoints;
|
std::vector<AnimationEvents *> *TweenPoints;
|
||||||
std::vector<MenuNotifierInterface *> NotificationComponents;
|
std::vector<MenuNotifierInterface *> NotificationComponents;
|
||||||
float TweenEnterTime;
|
float TweenEnterTime;
|
||||||
bool Focus;
|
bool Focus;
|
||||||
@ -127,6 +129,5 @@ private:
|
|||||||
SDL_Color FontColor;
|
SDL_Color FontColor;
|
||||||
std::string LayoutKey;
|
std::string LayoutKey;
|
||||||
std::string ImageType;
|
std::string ImageType;
|
||||||
unsigned int MaxLayer;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -368,6 +368,13 @@ bool Page::PushCollection(CollectionInfo *collection)
|
|||||||
menuExitIndex = MenuDepth - 1;
|
menuExitIndex = MenuDepth - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(Menus.size() >= MenuDepth && ActiveMenu)
|
||||||
|
{
|
||||||
|
ScrollingList *newList = new ScrollingList(*ActiveMenu);
|
||||||
|
newList->ForceIdle();
|
||||||
|
PushMenu(newList);
|
||||||
|
}
|
||||||
|
|
||||||
ActiveMenu = Menus[MenuDepth];
|
ActiveMenu = Menus[MenuDepth];
|
||||||
ActiveMenu->SetCollectionName(collection->GetName());
|
ActiveMenu->SetCollectionName(collection->GetName());
|
||||||
ActiveMenu->DestroyItems();
|
ActiveMenu->DestroyItems();
|
||||||
|
|||||||
@ -23,7 +23,7 @@
|
|||||||
#include "Component/ReloadableText.h"
|
#include "Component/ReloadableText.h"
|
||||||
#include "Component/ReloadableMedia.h"
|
#include "Component/ReloadableMedia.h"
|
||||||
#include "Component/ScrollingList.h"
|
#include "Component/ScrollingList.h"
|
||||||
#include "Animate/TweenSets.h"
|
#include "Animate/AnimationEvents.h"
|
||||||
#include "Animate/TweenTypes.h"
|
#include "Animate/TweenTypes.h"
|
||||||
#include "../Sound/Sound.h"
|
#include "../Sound/Sound.h"
|
||||||
#include "../Collection/Item.h"
|
#include "../Collection/Item.h"
|
||||||
@ -467,31 +467,31 @@ void PageBuilder::LoadTweens(Component *c, xml_node<> *componentXml)
|
|||||||
c->SetTweens(CreateTweenInstance(componentXml));
|
c->SetTweens(CreateTweenInstance(componentXml));
|
||||||
}
|
}
|
||||||
|
|
||||||
TweenSets *PageBuilder::CreateTweenInstance(xml_node<> *componentXml)
|
AnimationEvents *PageBuilder::CreateTweenInstance(xml_node<> *componentXml)
|
||||||
{
|
{
|
||||||
TweenSets *tweens = new TweenSets();
|
AnimationEvents *tweens = new AnimationEvents();
|
||||||
|
|
||||||
BuildTweenAttributes(tweens, componentXml, "onEnter", "enter");
|
BuildTweenSet(tweens, componentXml, "onEnter", "enter");
|
||||||
BuildTweenAttributes(tweens, componentXml, "onExit", "exit");
|
BuildTweenSet(tweens, componentXml, "onExit", "exit");
|
||||||
BuildTweenAttributes(tweens, componentXml, "onIdle", "idle");
|
BuildTweenSet(tweens, componentXml, "onIdle", "idle");
|
||||||
BuildTweenAttributes(tweens, componentXml, "onHighlightEnter", "highlightEnter");
|
BuildTweenSet(tweens, componentXml, "onHighlightEnter", "highlightEnter");
|
||||||
BuildTweenAttributes(tweens, componentXml, "onHighlightExit", "highlightExit");
|
BuildTweenSet(tweens, componentXml, "onHighlightExit", "highlightExit");
|
||||||
BuildTweenAttributes(tweens, componentXml, "onMenuEnter", "menuEnter");
|
BuildTweenSet(tweens, componentXml, "onMenuEnter", "menuEnter");
|
||||||
BuildTweenAttributes(tweens, componentXml, "onMenuExit", "menuExit");
|
BuildTweenSet(tweens, componentXml, "onMenuExit", "menuExit");
|
||||||
|
|
||||||
return tweens;
|
return tweens;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PageBuilder::BuildTweenAttributes(TweenSets *tweens, xml_node<> *componentXml, std::string tagName, std::string tweenName)
|
void PageBuilder::BuildTweenSet(AnimationEvents *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()))
|
for(componentXml = componentXml->first_node(tagName.c_str()); componentXml; componentXml = componentXml->next_sibling(tagName.c_str()))
|
||||||
{
|
{
|
||||||
xml_attribute<> *indexXml = componentXml->first_attribute("menuIndex");
|
xml_attribute<> *indexXml = componentXml->first_attribute("menuIndex");
|
||||||
int index = (indexXml) ? Utils::ConvertInt(indexXml->value()) : -1;
|
int index = (indexXml) ? Utils::ConvertInt(indexXml->value()) : -1;
|
||||||
|
|
||||||
TweenSets::TweenAttributes *sets = new TweenSets::TweenAttributes();
|
Animation *animation = new Animation();
|
||||||
GetTweenAttributes(componentXml, sets);
|
GetTweenSet(componentXml, animation);
|
||||||
tweens->SetTween(tweenName, index, sets);
|
tweens->SetAnimation(tweenName, index, animation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -560,7 +560,7 @@ ScrollingList * PageBuilder::BuildMenu(xml_node<> *menuXml)
|
|||||||
void PageBuilder::BuildCustomMenu(ScrollingList *menu, xml_node<> *menuXml, xml_node<> *itemDefaults)
|
void PageBuilder::BuildCustomMenu(ScrollingList *menu, xml_node<> *menuXml, xml_node<> *itemDefaults)
|
||||||
{
|
{
|
||||||
std::vector<ViewInfo *> *points = new std::vector<ViewInfo *>();
|
std::vector<ViewInfo *> *points = new std::vector<ViewInfo *>();
|
||||||
std::vector<TweenSets *> *tweenPoints = new std::vector<TweenSets *>();
|
std::vector<AnimationEvents *> *tweenPoints = new std::vector<AnimationEvents *>();
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
@ -587,7 +587,7 @@ void PageBuilder::BuildCustomMenu(ScrollingList *menu, xml_node<> *menuXml, xml_
|
|||||||
void PageBuilder::BuildVerticalMenu(ScrollingList *menu, xml_node<> *menuXml, xml_node<> *itemDefaults)
|
void PageBuilder::BuildVerticalMenu(ScrollingList *menu, xml_node<> *menuXml, xml_node<> *itemDefaults)
|
||||||
{
|
{
|
||||||
std::vector<ViewInfo *> *points = new std::vector<ViewInfo *>();
|
std::vector<ViewInfo *> *points = new std::vector<ViewInfo *>();
|
||||||
std::vector<TweenSets *> *tweenPoints = new std::vector<TweenSets *>();
|
std::vector<AnimationEvents *> *tweenPoints = new std::vector<AnimationEvents *>();
|
||||||
|
|
||||||
int selectedIndex = MENU_FIRST;
|
int selectedIndex = MENU_FIRST;
|
||||||
std::map<int, xml_node<> *> overrideItems;
|
std::map<int, xml_node<> *> overrideItems;
|
||||||
@ -810,20 +810,20 @@ void PageBuilder::BuildViewInfo(xml_node<> *componentXml, ViewInfo *info, xml_no
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PageBuilder::GetTweenAttributes(xml_node<> *node, std::vector<std::vector<Tween *> *> *TweenAttributes)
|
void PageBuilder::GetTweenSet(xml_node<> *node, Animation *animation)
|
||||||
{
|
{
|
||||||
if(node)
|
if(node)
|
||||||
{
|
{
|
||||||
for(xml_node<> *set = node->first_node("set"); set; set = set->next_sibling("set"))
|
for(xml_node<> *set = node->first_node("set"); set; set = set->next_sibling("set"))
|
||||||
{
|
{
|
||||||
std::vector<Tween *> *tweens = new std::vector<Tween *>();
|
TweenSet *ts = new TweenSet();
|
||||||
GetTweenSets(set, *tweens);
|
GetAnimationEvents(set, *ts);
|
||||||
TweenAttributes->push_back(tweens);
|
animation->Push(ts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PageBuilder::GetTweenSets(xml_node<> *node, std::vector<Tween *> &tweens)
|
void PageBuilder::GetAnimationEvents(xml_node<> *node, TweenSet &tweens)
|
||||||
{
|
{
|
||||||
xml_attribute<> *durationXml = node->first_attribute("duration");
|
xml_attribute<> *durationXml = node->first_attribute("duration");
|
||||||
|
|
||||||
@ -903,7 +903,7 @@ void PageBuilder::GetTweenSets(xml_node<> *node, std::vector<Tween *> &tweens)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Tween *t = new Tween(property, algorithm, fromValue, toValue, durationValue);
|
Tween *t = new Tween(property, algorithm, fromValue, toValue, durationValue);
|
||||||
tweens.push_back(t);
|
tweens.Push(t);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -53,14 +53,14 @@ private:
|
|||||||
void BuildViewInfo(rapidxml::xml_node<> *componentXml, ViewInfo *info, rapidxml::xml_node<> *defaultXml = NULL);
|
void BuildViewInfo(rapidxml::xml_node<> *componentXml, ViewInfo *info, rapidxml::xml_node<> *defaultXml = NULL);
|
||||||
bool BuildComponents(rapidxml::xml_node<> *layout, Page *page);
|
bool BuildComponents(rapidxml::xml_node<> *layout, Page *page);
|
||||||
void LoadTweens(Component *c, rapidxml::xml_node<> *componentXml);
|
void LoadTweens(Component *c, rapidxml::xml_node<> *componentXml);
|
||||||
TweenSets *CreateTweenInstance(rapidxml::xml_node<> *componentXml);
|
AnimationEvents *CreateTweenInstance(rapidxml::xml_node<> *componentXml);
|
||||||
void BuildTweenAttributes(TweenSets *tweens, rapidxml::xml_node<> *componentXml, std::string tagName, std::string tweenName);
|
void BuildTweenSet(AnimationEvents *tweens, rapidxml::xml_node<> *componentXml, std::string tagName, std::string tweenName);
|
||||||
ScrollingList * BuildMenu(rapidxml::xml_node<> *menuXml);
|
ScrollingList * BuildMenu(rapidxml::xml_node<> *menuXml);
|
||||||
void BuildCustomMenu(ScrollingList *menu, rapidxml::xml_node<> *menuXml, rapidxml::xml_node<> *itemDefaults);
|
void BuildCustomMenu(ScrollingList *menu, rapidxml::xml_node<> *menuXml, rapidxml::xml_node<> *itemDefaults);
|
||||||
void BuildVerticalMenu(ScrollingList *menu, rapidxml::xml_node<> *menuXml, rapidxml::xml_node<> *itemDefaults);
|
void BuildVerticalMenu(ScrollingList *menu, rapidxml::xml_node<> *menuXml, rapidxml::xml_node<> *itemDefaults);
|
||||||
int ParseMenuPosition(std::string strIndex);
|
int ParseMenuPosition(std::string strIndex);
|
||||||
rapidxml::xml_attribute<> *FindAttribute(rapidxml::xml_node<> *componentXml, std::string attribute, rapidxml::xml_node<> *defaultXml);
|
rapidxml::xml_attribute<> *FindAttribute(rapidxml::xml_node<> *componentXml, std::string attribute, rapidxml::xml_node<> *defaultXml);
|
||||||
void GetTweenAttributes(rapidxml::xml_node<> *node, std::vector<std::vector<Tween *> *> *TweenAttributes);
|
void GetTweenSet(rapidxml::xml_node<> *node, Animation *animation);
|
||||||
void GetTweenSets(rapidxml::xml_node<> *node, std::vector<Tween *> &tweens);
|
void GetAnimationEvents(rapidxml::xml_node<> *node, TweenSet &tweens);
|
||||||
ViewInfo * CreateMenuItemInfo(rapidxml::xml_node<> *component, rapidxml::xml_node<> *defaults, float y);
|
ViewInfo * CreateMenuItemInfo(rapidxml::xml_node<> *component, rapidxml::xml_node<> *defaults, float y);
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user