mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2025-12-28 09:38:52 +01:00
Added volume animation.
This commit is contained in:
parent
46cc7084d1
commit
1d54362885
@ -58,6 +58,7 @@ bool Tween::getTweenProperty(std::string name, TweenProperty &property)
|
||||
tweenPropertyMap_["containery"] = TWEEN_PROPERTY_CONTAINER_Y;
|
||||
tweenPropertyMap_["containerwidth"] = TWEEN_PROPERTY_CONTAINER_WIDTH;
|
||||
tweenPropertyMap_["containerheight"] = TWEEN_PROPERTY_CONTAINER_HEIGHT;
|
||||
tweenPropertyMap_["volume"] = TWEEN_PROPERTY_VOLUME;
|
||||
tweenPropertyMap_["nop"] = TWEEN_PROPERTY_NOP;
|
||||
}
|
||||
|
||||
|
||||
@ -62,5 +62,6 @@ enum TweenProperty
|
||||
TWEEN_PROPERTY_CONTAINER_Y,
|
||||
TWEEN_PROPERTY_CONTAINER_WIDTH,
|
||||
TWEEN_PROPERTY_CONTAINER_HEIGHT,
|
||||
TWEEN_PROPERTY_VOLUME,
|
||||
TWEEN_PROPERTY_NOP,
|
||||
};
|
||||
|
||||
@ -175,6 +175,7 @@ void Component::update(float dt)
|
||||
currentTweenIndex_ = 0;
|
||||
elapsedTweenTime_ = 0;
|
||||
storeViewInfo_ = baseViewInfo;
|
||||
storeVolume_ = getVolume();
|
||||
currentTweenComplete_ = false;
|
||||
}
|
||||
animationRequested_ = false;
|
||||
@ -194,6 +195,7 @@ void Component::update(float dt)
|
||||
currentTweenIndex_ = 0;
|
||||
elapsedTweenTime_ = 0;
|
||||
storeViewInfo_ = baseViewInfo;
|
||||
storeVolume_ = getVolume();
|
||||
currentTweenComplete_ = false;
|
||||
animationRequested_ = false;
|
||||
}
|
||||
@ -385,6 +387,12 @@ bool Component::animate()
|
||||
baseViewInfo.ContainerHeight = tween->animate(elapsedTime, storeViewInfo_.ContainerHeight);
|
||||
break;
|
||||
|
||||
case TWEEN_PROPERTY_VOLUME:
|
||||
if (tween->startDefined)
|
||||
setVolume(tween->animate(elapsedTime));
|
||||
else
|
||||
setVolume(tween->animate(elapsedTime, storeVolume_));
|
||||
|
||||
case TWEEN_PROPERTY_NOP:
|
||||
break;
|
||||
}
|
||||
|
||||
@ -72,6 +72,7 @@ private:
|
||||
SDL_Texture *backgroundTexture_;
|
||||
|
||||
ViewInfo storeViewInfo_;
|
||||
double storeVolume_;
|
||||
unsigned int currentTweenIndex_;
|
||||
bool currentTweenComplete_;
|
||||
float elapsedTweenTime_;
|
||||
|
||||
@ -1428,6 +1428,7 @@ void PageBuilder::getAnimationEvents(xml_node<> *node, TweenSet &tweens)
|
||||
case TWEEN_PROPERTY_FONT_SIZE:
|
||||
case TWEEN_PROPERTY_CONTAINER_Y:
|
||||
case TWEEN_PROPERTY_CONTAINER_HEIGHT:
|
||||
case TWEEN_PROPERTY_VOLUME:
|
||||
fromValue = getVerticalAlignment(from, 0);
|
||||
toValue = getVerticalAlignment(to, 0);
|
||||
break;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user