From d1263ccc92535cd6d3569d20ac81ef781c257a1f Mon Sep 17 00:00:00 2001 From: Pieter Hulshoff Date: Sat, 23 Jul 2016 10:06:32 +0200 Subject: [PATCH] Added animation support for containerX, containerY, containerWidth, and containerHeight. --- RetroFE/Source/Graphics/Animate/Tween.cpp | 4 +++ RetroFE/Source/Graphics/Animate/TweenTypes.h | 4 +++ .../Source/Graphics/Component/Component.cpp | 28 +++++++++++++++++++ RetroFE/Source/Graphics/PageBuilder.cpp | 4 +++ 4 files changed, 40 insertions(+) diff --git a/RetroFE/Source/Graphics/Animate/Tween.cpp b/RetroFE/Source/Graphics/Animate/Tween.cpp index afa5cde..3657892 100644 --- a/RetroFE/Source/Graphics/Animate/Tween.cpp +++ b/RetroFE/Source/Graphics/Animate/Tween.cpp @@ -54,6 +54,10 @@ bool Tween::getTweenProperty(std::string name, TweenProperty &property) tweenPropertyMap_["maxwidth"] = TWEEN_PROPERTY_MAX_WIDTH; tweenPropertyMap_["maxheight"] = TWEEN_PROPERTY_MAX_HEIGHT; tweenPropertyMap_["layer"] = TWEEN_PROPERTY_LAYER; + tweenPropertyMap_["containerx"] = TWEEN_PROPERTY_CONTAINER_X; + tweenPropertyMap_["containery"] = TWEEN_PROPERTY_CONTAINER_Y; + tweenPropertyMap_["containerwidth"] = TWEEN_PROPERTY_CONTAINER_WIDTH; + tweenPropertyMap_["containerheight"] = TWEEN_PROPERTY_CONTAINER_HEIGHT; tweenPropertyMap_["nop"] = TWEEN_PROPERTY_NOP; } diff --git a/RetroFE/Source/Graphics/Animate/TweenTypes.h b/RetroFE/Source/Graphics/Animate/TweenTypes.h index f1c9bb8..6526099 100644 --- a/RetroFE/Source/Graphics/Animate/TweenTypes.h +++ b/RetroFE/Source/Graphics/Animate/TweenTypes.h @@ -58,5 +58,9 @@ enum TweenProperty TWEEN_PROPERTY_MAX_WIDTH, TWEEN_PROPERTY_MAX_HEIGHT, TWEEN_PROPERTY_LAYER, + TWEEN_PROPERTY_CONTAINER_X, + TWEEN_PROPERTY_CONTAINER_Y, + TWEEN_PROPERTY_CONTAINER_WIDTH, + TWEEN_PROPERTY_CONTAINER_HEIGHT, TWEEN_PROPERTY_NOP, }; diff --git a/RetroFE/Source/Graphics/Component/Component.cpp b/RetroFE/Source/Graphics/Component/Component.cpp index 6b68d4c..ede499b 100644 --- a/RetroFE/Source/Graphics/Component/Component.cpp +++ b/RetroFE/Source/Graphics/Component/Component.cpp @@ -309,6 +309,34 @@ bool Component::animate() baseViewInfo.Layer = static_cast(tween->animate(elapsedTime, storeViewInfo_.Layer)); break; + case TWEEN_PROPERTY_CONTAINER_X: + if (tween->startDefined) + baseViewInfo.ContainerX = tween->animate(elapsedTime); + else + baseViewInfo.ContainerX = tween->animate(elapsedTime, storeViewInfo_.ContainerX); + break; + + case TWEEN_PROPERTY_CONTAINER_Y: + if (tween->startDefined) + baseViewInfo.ContainerY = tween->animate(elapsedTime); + else + baseViewInfo.ContainerY = tween->animate(elapsedTime, storeViewInfo_.ContainerY); + break; + + case TWEEN_PROPERTY_CONTAINER_WIDTH: + if (tween->startDefined) + baseViewInfo.ContainerWidth = tween->animate(elapsedTime); + else + baseViewInfo.ContainerWidth = tween->animate(elapsedTime, storeViewInfo_.ContainerWidth); + break; + + case TWEEN_PROPERTY_CONTAINER_HEIGHT: + if (tween->startDefined) + baseViewInfo.ContainerHeight = tween->animate(elapsedTime); + else + baseViewInfo.ContainerHeight = tween->animate(elapsedTime, storeViewInfo_.ContainerHeight); + break; + case TWEEN_PROPERTY_NOP: break; } diff --git a/RetroFE/Source/Graphics/PageBuilder.cpp b/RetroFE/Source/Graphics/PageBuilder.cpp index c10158c..3a28fa7 100644 --- a/RetroFE/Source/Graphics/PageBuilder.cpp +++ b/RetroFE/Source/Graphics/PageBuilder.cpp @@ -1162,6 +1162,8 @@ void PageBuilder::getAnimationEvents(xml_node<> *node, TweenSet &tweens) case TWEEN_PROPERTY_WIDTH: case TWEEN_PROPERTY_X: case TWEEN_PROPERTY_X_OFFSET: + case TWEEN_PROPERTY_CONTAINER_X: + case TWEEN_PROPERTY_CONTAINER_WIDTH: fromValue = getHorizontalAlignment(from, 0); toValue = getHorizontalAlignment(to, 0); break; @@ -1176,6 +1178,8 @@ void PageBuilder::getAnimationEvents(xml_node<> *node, TweenSet &tweens) case TWEEN_PROPERTY_Y: case TWEEN_PROPERTY_Y_OFFSET: case TWEEN_PROPERTY_FONT_SIZE: + case TWEEN_PROPERTY_CONTAINER_Y: + case TWEEN_PROPERTY_CONTAINER_HEIGHT: fromValue = getVerticalAlignment(from, 0); toValue = getVerticalAlignment(to, 0); break;