Cleanup from old sandbox code. Moved component implementation from header file to source file.

This commit is contained in:
emb 2015-02-16 07:48:57 -06:00
parent 10b65d7021
commit 5d455d1174
5 changed files with 48 additions and 37 deletions

View File

@ -16,6 +16,10 @@
#include "TweenSets.h"
TweenSets::TweenSets()
{
}
TweenSets::~TweenSets()
{
DestroyTweens();

View File

@ -23,6 +23,7 @@
class TweenSets
{
public:
TweenSets();
~TweenSets();
typedef std::vector<std::vector<Tween *> *> TweenAttributes;

View File

@ -146,6 +146,40 @@ void Component::SetCollectionName(std::string collectionName)
CollectionName = collectionName;
}
TweenSets *Component::GetTweens()
{
return Tweens;
}
void Component::SetTweens(TweenSets *set)
{
Tweens = set;
CurrentAnimationState = IDLE;
CurrentTweenIndex = 0;
CurrentTweenComplete = false;
ElapsedTweenTime = 0;
}
ViewInfo *Component::GetBaseViewInfo()
{
return &BaseViewInfo;
}
void Component::UpdateBaseViewInfo(ViewInfo &info)
{
BaseViewInfo = info;
}
bool Component::IsScrollActive() const
{
return ScrollActive;
}
void Component::SetScrollActive(bool scrollActive)
{
ScrollActive = scrollActive;
}
void Component::Update(float dt)
{
ElapsedTweenTime += dt;

View File

@ -45,43 +45,15 @@ public:
bool IsMenuScrolling();
std::string GetCollectionName();
void SetCollectionName(std::string collectionName);
typedef std::vector<std::vector<Tween *> *> TweenAttributes;
TweenSets *GetTweens() { return Tweens; }
void SetTweens(TweenSets *set)
{
Tweens = set;
CurrentAnimationState = IDLE;
CurrentTweenIndex = 0;
CurrentTweenComplete = false;
ElapsedTweenTime = 0;
}
virtual void Update(float dt);
virtual void Draw();
ViewInfo *GetBaseViewInfo()
{
return &BaseViewInfo;
}
void UpdateBaseViewInfo(ViewInfo &info)
{
BaseViewInfo = info;
}
bool IsScrollActive() const
{
return ScrollActive;
}
void SetScrollActive(bool scrollActive)
{
ScrollActive = scrollActive;
}
TweenSets *GetTweens();
void SetTweens(TweenSets *set);
ViewInfo *GetBaseViewInfo();
void UpdateBaseViewInfo(ViewInfo &info);
bool IsScrollActive() const;
void SetScrollActive(bool scrollActive);
protected:
std::string CollectionName;
@ -119,7 +91,7 @@ private:
bool IsTweenSequencingComplete();
void ResetTweenSequence(std::vector<ViewInfo *> *tweens);
TweenSets *Tweens;
TweenAttributes *CurrentTweens;
TweenSets::TweenAttributes *CurrentTweens;
unsigned int CurrentTweenIndex;
bool CurrentTweenComplete;

View File

@ -531,8 +531,8 @@ void ScrollingList::ResetTweens(Component *c, TweenSets *sets, ViewInfo *current
//todo: delete properly, memory leak (big), proof of concept
c->SetTweens(sets);
TweenAttributes *scrollTween = sets->GetTween("menuScroll");
TweenAttributes::iterator it = scrollTween->begin();
TweenSets::TweenAttributes *scrollTween = sets->GetTween("menuScroll");
TweenSets::TweenAttributes::iterator it = scrollTween->begin();
while(it != scrollTween->end())
{