mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2025-12-13 02:08:52 +01:00
Added animation types maxWidth, maxHeight, and nop (no-operation; do
nothing). Fixed onHighlightEnter and onHighlightExit animations, which were not started at all.
This commit is contained in:
parent
537322f9c0
commit
a55fd84d58
@ -51,6 +51,9 @@ bool Tween::getTweenProperty(std::string name, TweenProperty &property)
|
|||||||
tweenPropertyMap_["yoffset"] = TWEEN_PROPERTY_Y_OFFSET;
|
tweenPropertyMap_["yoffset"] = TWEEN_PROPERTY_Y_OFFSET;
|
||||||
tweenPropertyMap_["fontSize"] = TWEEN_PROPERTY_FONT_SIZE;
|
tweenPropertyMap_["fontSize"] = TWEEN_PROPERTY_FONT_SIZE;
|
||||||
tweenPropertyMap_["backgroundalpha"] = TWEEN_PROPERTY_BACKGROUND_ALPHA;
|
tweenPropertyMap_["backgroundalpha"] = TWEEN_PROPERTY_BACKGROUND_ALPHA;
|
||||||
|
tweenPropertyMap_["maxwidth"] = TWEEN_PROPERTY_MAX_WIDTH;
|
||||||
|
tweenPropertyMap_["maxheight"] = TWEEN_PROPERTY_MAX_HEIGHT;
|
||||||
|
tweenPropertyMap_["nop"] = TWEEN_PROPERTY_NOP;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::transform(name.begin(), name.end(), name.begin(), ::tolower);
|
std::transform(name.begin(), name.end(), name.begin(), ::tolower);
|
||||||
|
|||||||
@ -55,4 +55,7 @@ enum TweenProperty
|
|||||||
TWEEN_PROPERTY_Y_OFFSET,
|
TWEEN_PROPERTY_Y_OFFSET,
|
||||||
TWEEN_PROPERTY_FONT_SIZE,
|
TWEEN_PROPERTY_FONT_SIZE,
|
||||||
TWEEN_PROPERTY_BACKGROUND_ALPHA,
|
TWEEN_PROPERTY_BACKGROUND_ALPHA,
|
||||||
|
TWEEN_PROPERTY_MAX_WIDTH,
|
||||||
|
TWEEN_PROPERTY_MAX_HEIGHT,
|
||||||
|
TWEEN_PROPERTY_NOP,
|
||||||
};
|
};
|
||||||
|
|||||||
@ -287,6 +287,23 @@ bool Component::animate()
|
|||||||
else
|
else
|
||||||
baseViewInfo.BackgroundAlpha = tween->animate(elapsedTime, storeViewInfo_.BackgroundAlpha);
|
baseViewInfo.BackgroundAlpha = tween->animate(elapsedTime, storeViewInfo_.BackgroundAlpha);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case TWEEN_PROPERTY_MAX_WIDTH:
|
||||||
|
if (tween->startDefined)
|
||||||
|
baseViewInfo.MaxWidth = tween->animate(elapsedTime);
|
||||||
|
else
|
||||||
|
baseViewInfo.MaxWidth = tween->animate(elapsedTime, storeViewInfo_.MaxWidth);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TWEEN_PROPERTY_MAX_HEIGHT:
|
||||||
|
if (tween->startDefined)
|
||||||
|
baseViewInfo.MaxHeight = tween->animate(elapsedTime);
|
||||||
|
else
|
||||||
|
baseViewInfo.MaxHeight = tween->animate(elapsedTime, storeViewInfo_.MaxHeight);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TWEEN_PROPERTY_NOP:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -580,6 +580,8 @@ void ScrollingList::resetTweens(Component *c, AnimationEvents *sets, ViewInfo *c
|
|||||||
set->push(new Tween(TWEEN_PROPERTY_Y_OFFSET, EASE_INOUT_QUADRATIC, currentViewInfo->YOffset, nextViewInfo->YOffset, scrollTime));
|
set->push(new Tween(TWEEN_PROPERTY_Y_OFFSET, EASE_INOUT_QUADRATIC, currentViewInfo->YOffset, nextViewInfo->YOffset, scrollTime));
|
||||||
set->push(new Tween(TWEEN_PROPERTY_FONT_SIZE, EASE_INOUT_QUADRATIC, currentViewInfo->FontSize, nextViewInfo->FontSize, scrollTime));
|
set->push(new Tween(TWEEN_PROPERTY_FONT_SIZE, EASE_INOUT_QUADRATIC, currentViewInfo->FontSize, nextViewInfo->FontSize, scrollTime));
|
||||||
set->push(new Tween(TWEEN_PROPERTY_BACKGROUND_ALPHA, EASE_INOUT_QUADRATIC, currentViewInfo->BackgroundAlpha, nextViewInfo->BackgroundAlpha, scrollTime));
|
set->push(new Tween(TWEEN_PROPERTY_BACKGROUND_ALPHA, EASE_INOUT_QUADRATIC, currentViewInfo->BackgroundAlpha, nextViewInfo->BackgroundAlpha, scrollTime));
|
||||||
|
set->push(new Tween(TWEEN_PROPERTY_MAX_WIDTH, EASE_INOUT_QUADRATIC, currentViewInfo->MaxWidth, nextViewInfo->MaxWidth, scrollTime));
|
||||||
|
set->push(new Tween(TWEEN_PROPERTY_MAX_HEIGHT, EASE_INOUT_QUADRATIC, currentViewInfo->MaxHeight, nextViewInfo->MaxHeight, scrollTime));
|
||||||
scrollTween->Push(set);
|
scrollTween->Push(set);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -372,14 +372,14 @@ void Page::highlightEnter()
|
|||||||
if(!item) return;
|
if(!item) return;
|
||||||
if(activeMenu_)
|
if(activeMenu_)
|
||||||
{
|
{
|
||||||
activeMenu_->triggerEvent( "highlightEnter" );
|
activeMenu_->triggerEvent( "highlightEnter", menuDepth_ - 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
for(unsigned int i = 0; i < NUM_LAYERS; ++i)
|
for(unsigned int i = 0; i < NUM_LAYERS; ++i)
|
||||||
{
|
{
|
||||||
for(std::vector<Component *>::iterator it = LayerComponents[i].begin(); it != LayerComponents[i].end(); ++it)
|
for(std::vector<Component *>::iterator it = LayerComponents[i].begin(); it != LayerComponents[i].end(); ++it)
|
||||||
{
|
{
|
||||||
(*it)->triggerEvent( "highlightEnter" );
|
(*it)->triggerEvent( "highlightEnter", menuDepth_ - 1 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -392,14 +392,14 @@ void Page::highlightExit()
|
|||||||
if(!item) return;
|
if(!item) return;
|
||||||
if(activeMenu_)
|
if(activeMenu_)
|
||||||
{
|
{
|
||||||
activeMenu_->triggerEvent( "highlightExit" );
|
activeMenu_->triggerEvent( "highlightExit", menuDepth_ - 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
for(unsigned int i = 0; i < NUM_LAYERS; ++i)
|
for(unsigned int i = 0; i < NUM_LAYERS; ++i)
|
||||||
{
|
{
|
||||||
for(std::vector<Component *>::iterator it = LayerComponents[i].begin(); it != LayerComponents[i].end(); ++it)
|
for(std::vector<Component *>::iterator it = LayerComponents[i].begin(); it != LayerComponents[i].end(); ++it)
|
||||||
{
|
{
|
||||||
(*it)->triggerEvent( "highlightExit" );
|
(*it)->triggerEvent( "highlightExit", menuDepth_ - 1 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -862,3 +862,9 @@ void Page::resetMenuItems()
|
|||||||
activeMenu_->deallocateSpritePoints();
|
activeMenu_->deallocateSpritePoints();
|
||||||
activeMenu_->allocateSpritePoints();
|
activeMenu_->allocateSpritePoints();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Page::isMenuScrolling()
|
||||||
|
{
|
||||||
|
return scrollActive_;
|
||||||
|
}
|
||||||
|
|||||||
@ -87,13 +87,14 @@ public:
|
|||||||
std::string getCollectionName();
|
std::string getCollectionName();
|
||||||
void setMinShowTime(float value);
|
void setMinShowTime(float value);
|
||||||
float getMinShowTime();
|
float getMinShowTime();
|
||||||
|
void highlightEnter();
|
||||||
|
void highlightExit();
|
||||||
void addPlaylist();
|
void addPlaylist();
|
||||||
void removePlaylist();
|
void removePlaylist();
|
||||||
void resetMenuItems();
|
void resetMenuItems();
|
||||||
|
bool isMenuScrolling();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void highlightEnter();
|
|
||||||
void highlightExit();
|
|
||||||
void playlistChange();
|
void playlistChange();
|
||||||
std::string collectionName_;
|
std::string collectionName_;
|
||||||
Configuration &config_;
|
Configuration &config_;
|
||||||
|
|||||||
@ -966,11 +966,18 @@ void PageBuilder::getAnimationEvents(xml_node<> *node, TweenSet &tweens)
|
|||||||
xml_attribute<> *to = animate->first_attribute("to");
|
xml_attribute<> *to = animate->first_attribute("to");
|
||||||
xml_attribute<> *algorithmXml = animate->first_attribute("algorithm");
|
xml_attribute<> *algorithmXml = animate->first_attribute("algorithm");
|
||||||
|
|
||||||
|
std::string animateType;
|
||||||
|
if (type)
|
||||||
|
{
|
||||||
|
animateType = type->value();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if(!type)
|
if(!type)
|
||||||
{
|
{
|
||||||
Logger::write(Logger::ZONE_ERROR, "Layout", "Animate tag missing \"type\" attribute");
|
Logger::write(Logger::ZONE_ERROR, "Layout", "Animate tag missing \"type\" attribute");
|
||||||
}
|
}
|
||||||
else if(!to)
|
else if(!to && animateType != "nop")
|
||||||
{
|
{
|
||||||
Logger::write(Logger::ZONE_ERROR, "Layout", "Animate tag missing \"to\" attribute");
|
Logger::write(Logger::ZONE_ERROR, "Layout", "Animate tag missing \"to\" attribute");
|
||||||
}
|
}
|
||||||
@ -979,10 +986,18 @@ void PageBuilder::getAnimationEvents(xml_node<> *node, TweenSet &tweens)
|
|||||||
float fromValue = 0.0f;
|
float fromValue = 0.0f;
|
||||||
bool fromDefined = true;
|
bool fromDefined = true;
|
||||||
if (from)
|
if (from)
|
||||||
|
{
|
||||||
fromValue = Utils::convertFloat(from->value());
|
fromValue = Utils::convertFloat(from->value());
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
fromDefined = false;
|
fromDefined = false;
|
||||||
float toValue = Utils::convertFloat(to->value());
|
}
|
||||||
|
float toValue = 0.0f;
|
||||||
|
if (to)
|
||||||
|
{
|
||||||
|
toValue = Utils::convertFloat(to->value());
|
||||||
|
}
|
||||||
float durationValue = Utils::convertFloat(durationXml->value());
|
float durationValue = Utils::convertFloat(durationXml->value());
|
||||||
|
|
||||||
TweenAlgorithm algorithm = LINEAR;
|
TweenAlgorithm algorithm = LINEAR;
|
||||||
@ -1025,6 +1040,11 @@ void PageBuilder::getAnimationEvents(xml_node<> *node, TweenSet &tweens)
|
|||||||
toValue = getVerticalAlignment(to, 0) / screenHeight_;
|
toValue = getVerticalAlignment(to, 0) / screenHeight_;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case TWEEN_PROPERTY_MAX_WIDTH:
|
||||||
|
case TWEEN_PROPERTY_MAX_HEIGHT:
|
||||||
|
fromValue = getVerticalAlignment(from, FLT_MAX);
|
||||||
|
toValue = getVerticalAlignment(to, FLT_MAX);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -334,6 +334,26 @@ void RetroFE::run()
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case RETROFE_HIGHLIGHT_REQUEST:
|
||||||
|
currentPage_->highlightExit();
|
||||||
|
state = RETROFE_HIGHLIGHT_EXIT;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RETROFE_HIGHLIGHT_EXIT:
|
||||||
|
if (currentPage_->isIdle())
|
||||||
|
{
|
||||||
|
currentPage_->highlightEnter();
|
||||||
|
state = RETROFE_HIGHLIGHT_ENTER;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RETROFE_HIGHLIGHT_ENTER:
|
||||||
|
if (currentPage_->isIdle())
|
||||||
|
{
|
||||||
|
state = RETROFE_IDLE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case RETROFE_NEXT_PAGE_REQUEST:
|
case RETROFE_NEXT_PAGE_REQUEST:
|
||||||
currentPage_->exitMenu();
|
currentPage_->exitMenu();
|
||||||
state = RETROFE_NEXT_PAGE_MENU_EXIT;
|
state = RETROFE_NEXT_PAGE_MENU_EXIT;
|
||||||
@ -636,6 +656,8 @@ RetroFE::RETROFE_STATE RetroFE::processUserInput(Page *page)
|
|||||||
!input_.keystate(UserInput::KeyCodePageUp) &&
|
!input_.keystate(UserInput::KeyCodePageUp) &&
|
||||||
!input_.keystate(UserInput::KeyCodePageDown))
|
!input_.keystate(UserInput::KeyCodePageDown))
|
||||||
{
|
{
|
||||||
|
if (page->isMenuScrolling())
|
||||||
|
state = RETROFE_HIGHLIGHT_REQUEST;
|
||||||
page->setScrolling(Page::ScrollDirectionIdle);
|
page->setScrolling(Page::ScrollDirectionIdle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -54,6 +54,9 @@ private:
|
|||||||
RETROFE_IDLE,
|
RETROFE_IDLE,
|
||||||
RETROFE_ENTER,
|
RETROFE_ENTER,
|
||||||
RETROFE_EXIT,
|
RETROFE_EXIT,
|
||||||
|
RETROFE_HIGHLIGHT_REQUEST,
|
||||||
|
RETROFE_HIGHLIGHT_EXIT,
|
||||||
|
RETROFE_HIGHLIGHT_ENTER,
|
||||||
RETROFE_NEXT_PAGE_REQUEST,
|
RETROFE_NEXT_PAGE_REQUEST,
|
||||||
RETROFE_NEXT_PAGE_MENU_EXIT,
|
RETROFE_NEXT_PAGE_MENU_EXIT,
|
||||||
RETROFE_NEXT_PAGE_MENU_ENTER,
|
RETROFE_NEXT_PAGE_MENU_ENTER,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user