From 5d455d11749e04bfd6c91e79186005e3b1734a66 Mon Sep 17 00:00:00 2001 From: emb <> Date: Mon, 16 Feb 2015 07:48:57 -0600 Subject: [PATCH] Cleanup from old sandbox code. Moved component implementation from header file to source file. --- RetroFE/Source/Graphics/Animate/TweenSets.cpp | 4 ++ RetroFE/Source/Graphics/Animate/TweenSets.h | 1 + .../Source/Graphics/Component/Component.cpp | 34 +++++++++++++++ RetroFE/Source/Graphics/Component/Component.h | 42 ++++--------------- .../Graphics/Component/ScrollingList.cpp | 4 +- 5 files changed, 48 insertions(+), 37 deletions(-) diff --git a/RetroFE/Source/Graphics/Animate/TweenSets.cpp b/RetroFE/Source/Graphics/Animate/TweenSets.cpp index a964e7c..ed3ad8d 100644 --- a/RetroFE/Source/Graphics/Animate/TweenSets.cpp +++ b/RetroFE/Source/Graphics/Animate/TweenSets.cpp @@ -16,6 +16,10 @@ #include "TweenSets.h" +TweenSets::TweenSets() +{ +} + TweenSets::~TweenSets() { DestroyTweens(); diff --git a/RetroFE/Source/Graphics/Animate/TweenSets.h b/RetroFE/Source/Graphics/Animate/TweenSets.h index c28acc0..b9d09e9 100644 --- a/RetroFE/Source/Graphics/Animate/TweenSets.h +++ b/RetroFE/Source/Graphics/Animate/TweenSets.h @@ -23,6 +23,7 @@ class TweenSets { public: + TweenSets(); ~TweenSets(); typedef std::vector *> TweenAttributes; diff --git a/RetroFE/Source/Graphics/Component/Component.cpp b/RetroFE/Source/Graphics/Component/Component.cpp index f4ba4ee..95558b9 100644 --- a/RetroFE/Source/Graphics/Component/Component.cpp +++ b/RetroFE/Source/Graphics/Component/Component.cpp @@ -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; diff --git a/RetroFE/Source/Graphics/Component/Component.h b/RetroFE/Source/Graphics/Component/Component.h index 5f5c7c9..8d8c35f 100644 --- a/RetroFE/Source/Graphics/Component/Component.h +++ b/RetroFE/Source/Graphics/Component/Component.h @@ -45,43 +45,15 @@ public: bool IsMenuScrolling(); std::string GetCollectionName(); void SetCollectionName(std::string collectionName); - typedef std::vector *> 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 *tweens); TweenSets *Tweens; - TweenAttributes *CurrentTweens; + TweenSets::TweenAttributes *CurrentTweens; unsigned int CurrentTweenIndex; bool CurrentTweenComplete; diff --git a/RetroFE/Source/Graphics/Component/ScrollingList.cpp b/RetroFE/Source/Graphics/Component/ScrollingList.cpp index a7d6ffa..dd6ac34 100644 --- a/RetroFE/Source/Graphics/Component/ScrollingList.cpp +++ b/RetroFE/Source/Graphics/Component/ScrollingList.cpp @@ -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()) {