mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2026-09-17 20:52:20 +02:00
Added support for onAttractEnter/onAttract/onAttractExit animation types.
This commit is contained in:
@@ -131,6 +131,11 @@ void Component::setId( int id )
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Component::isIdle()
|
bool Component::isIdle()
|
||||||
|
{
|
||||||
|
return (currentTweenComplete_ || animationType_ == "idle" || animationType_ == "menuIdle" || animationType_ == "attract");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Component::isAttractIdle()
|
||||||
{
|
{
|
||||||
return (currentTweenComplete_ || animationType_ == "idle" || animationType_ == "menuIdle");
|
return (currentTweenComplete_ || animationType_ == "idle" || animationType_ == "menuIdle");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ public:
|
|||||||
void setNewItemSelected();
|
void setNewItemSelected();
|
||||||
void setNewScrollItemSelected();
|
void setNewScrollItemSelected();
|
||||||
bool isIdle();
|
bool isIdle();
|
||||||
|
bool isAttractIdle();
|
||||||
bool isMenuScrolling();
|
bool isMenuScrolling();
|
||||||
bool newItemSelected;
|
bool newItemSelected;
|
||||||
bool newScrollItemSelected;
|
bool newScrollItemSelected;
|
||||||
|
|||||||
@@ -589,6 +589,33 @@ void ScrollingList::triggerMenuJumpExitEvent( int menuIndex )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScrollingList::triggerAttractEnterEvent( int menuIndex )
|
||||||
|
{
|
||||||
|
for ( unsigned int i = 0; i < components_.size( ); ++i )
|
||||||
|
{
|
||||||
|
Component *c = components_.at( i );
|
||||||
|
if ( c ) c->triggerEvent( "attractEnter", menuIndex );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScrollingList::triggerAttractEvent( int menuIndex )
|
||||||
|
{
|
||||||
|
for ( unsigned int i = 0; i < components_.size( ); ++i )
|
||||||
|
{
|
||||||
|
Component *c = components_.at( i );
|
||||||
|
if ( c ) c->triggerEvent( "attract", menuIndex );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScrollingList::triggerAttractExitEvent( int menuIndex )
|
||||||
|
{
|
||||||
|
for ( unsigned int i = 0; i < components_.size( ); ++i )
|
||||||
|
{
|
||||||
|
Component *c = components_.at( i );
|
||||||
|
if ( c ) c->triggerEvent( "attractExit", menuIndex );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ScrollingList::update( float dt )
|
void ScrollingList::update( float dt )
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -854,6 +881,20 @@ bool ScrollingList::isIdle( )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool ScrollingList::isAttractIdle( )
|
||||||
|
{
|
||||||
|
if ( !Component::isAttractIdle( ) ) return false;
|
||||||
|
|
||||||
|
for ( unsigned int i = 0; i < components_.size( ); ++i )
|
||||||
|
{
|
||||||
|
Component *c = components_.at( i );
|
||||||
|
if ( c && !c->isAttractIdle( ) ) return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void ScrollingList::resetScrollPeriod( )
|
void ScrollingList::resetScrollPeriod( )
|
||||||
{
|
{
|
||||||
scrollPeriod_ = startScrollTime_;
|
scrollPeriod_ = startScrollTime_;
|
||||||
|
|||||||
@@ -57,6 +57,9 @@ public:
|
|||||||
void triggerPlaylistExitEvent( int menuIndex = -1 );
|
void triggerPlaylistExitEvent( int menuIndex = -1 );
|
||||||
void triggerMenuJumpEnterEvent( int menuIndex = -1 );
|
void triggerMenuJumpEnterEvent( int menuIndex = -1 );
|
||||||
void triggerMenuJumpExitEvent( int menuIndex = -1 );
|
void triggerMenuJumpExitEvent( int menuIndex = -1 );
|
||||||
|
void triggerAttractEnterEvent( int menuIndex = -1 );
|
||||||
|
void triggerAttractEvent( int menuIndex = -1 );
|
||||||
|
void triggerAttractExitEvent( int menuIndex = -1 );
|
||||||
|
|
||||||
bool allocateTexture( unsigned int index, Item *i );
|
bool allocateTexture( unsigned int index, Item *i );
|
||||||
void deallocateTexture( unsigned int index );
|
void deallocateTexture( unsigned int index );
|
||||||
@@ -78,6 +81,7 @@ public:
|
|||||||
void cfwLetterSubDown( );
|
void cfwLetterSubDown( );
|
||||||
void random( );
|
void random( );
|
||||||
bool isIdle( );
|
bool isIdle( );
|
||||||
|
bool isAttractIdle( );
|
||||||
unsigned int getScrollOffsetIndex( );
|
unsigned int getScrollOffsetIndex( );
|
||||||
void setScrollOffsetIndex( unsigned int index );
|
void setScrollOffsetIndex( unsigned int index );
|
||||||
void setSelectedIndex( int selectedIndex );
|
void setSelectedIndex( int selectedIndex );
|
||||||
|
|||||||
@@ -275,6 +275,33 @@ bool Page::isIdle()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Page::isAttractIdle()
|
||||||
|
{
|
||||||
|
bool idle = true;
|
||||||
|
|
||||||
|
for(MenuVector_T::iterator it = menus_.begin(); it != menus_.end(); it++)
|
||||||
|
{
|
||||||
|
for(std::vector<ScrollingList *>::iterator it2 = menus_[std::distance(menus_.begin(), it)].begin(); it2 != menus_[std::distance(menus_.begin(), it)].end(); it2++)
|
||||||
|
{
|
||||||
|
ScrollingList *menu = *it2;
|
||||||
|
|
||||||
|
if(!menu->isAttractIdle())
|
||||||
|
{
|
||||||
|
idle = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(std::vector<Component *>::iterator it = LayerComponents.begin(); it != LayerComponents.end() && idle; ++it)
|
||||||
|
{
|
||||||
|
idle = (*it)->isAttractIdle();
|
||||||
|
}
|
||||||
|
|
||||||
|
return idle;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Page::isGraphicsIdle()
|
bool Page::isGraphicsIdle()
|
||||||
{
|
{
|
||||||
bool idle = true;
|
bool idle = true;
|
||||||
@@ -607,6 +634,99 @@ void Page::menuJumpExit()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Page::attractEnter()
|
||||||
|
{
|
||||||
|
Item *item = selectedItem_;
|
||||||
|
|
||||||
|
if(!item) return;
|
||||||
|
for(MenuVector_T::iterator it = menus_.begin(); it != menus_.end(); it++)
|
||||||
|
{
|
||||||
|
for(std::vector<ScrollingList *>::iterator it2 = menus_[std::distance(menus_.begin(), it)].begin(); it2 != menus_[std::distance(menus_.begin(), it)].end(); it2++)
|
||||||
|
{
|
||||||
|
ScrollingList *menu = *it2;
|
||||||
|
if(menuDepth_-1 == static_cast<unsigned int>(distance(menus_.begin(), it)))
|
||||||
|
{
|
||||||
|
// Also trigger animations for index i for active menu
|
||||||
|
menu->triggerEvent( "attractEnter", MENU_INDEX_HIGH + menuDepth_ - 1 );
|
||||||
|
menu->triggerAttractEnterEvent( MENU_INDEX_HIGH + menuDepth_ - 1 );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
menu->triggerEvent( "attractEnter", menuDepth_ - 1 );
|
||||||
|
menu->triggerAttractEnterEvent( menuDepth_ - 1 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(std::vector<Component *>::iterator it = LayerComponents.begin(); it != LayerComponents.end(); ++it)
|
||||||
|
{
|
||||||
|
(*it)->triggerEvent( "attractEnter", menuDepth_ - 1 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Page::attract()
|
||||||
|
{
|
||||||
|
Item *item = selectedItem_;
|
||||||
|
|
||||||
|
if(!item) return;
|
||||||
|
for(MenuVector_T::iterator it = menus_.begin(); it != menus_.end(); it++)
|
||||||
|
{
|
||||||
|
for(std::vector<ScrollingList *>::iterator it2 = menus_[std::distance(menus_.begin(), it)].begin(); it2 != menus_[std::distance(menus_.begin(), it)].end(); it2++)
|
||||||
|
{
|
||||||
|
ScrollingList *menu = *it2;
|
||||||
|
if(menuDepth_-1 == static_cast<unsigned int>(distance(menus_.begin(), it)))
|
||||||
|
{
|
||||||
|
// Also trigger animations for index i for active menu
|
||||||
|
menu->triggerEvent( "attract", MENU_INDEX_HIGH + menuDepth_ - 1 );
|
||||||
|
menu->triggerAttractEvent( MENU_INDEX_HIGH + menuDepth_ - 1 );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
menu->triggerEvent( "attract", menuDepth_ - 1 );
|
||||||
|
menu->triggerAttractEvent( menuDepth_ - 1 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(std::vector<Component *>::iterator it = LayerComponents.begin(); it != LayerComponents.end(); ++it)
|
||||||
|
{
|
||||||
|
(*it)->triggerEvent( "attract", menuDepth_ - 1 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Page::attractExit()
|
||||||
|
{
|
||||||
|
Item *item = selectedItem_;
|
||||||
|
|
||||||
|
if(!item) return;
|
||||||
|
for(MenuVector_T::iterator it = menus_.begin(); it != menus_.end(); it++)
|
||||||
|
{
|
||||||
|
for(std::vector<ScrollingList *>::iterator it2 = menus_[std::distance(menus_.begin(), it)].begin(); it2 != menus_[std::distance(menus_.begin(), it)].end(); it2++)
|
||||||
|
{
|
||||||
|
ScrollingList *menu = *it2;
|
||||||
|
if(menuDepth_-1 == static_cast<unsigned int>(distance(menus_.begin(), it)))
|
||||||
|
{
|
||||||
|
// Also trigger animations for index i for active menu
|
||||||
|
menu->triggerEvent( "attractExit", MENU_INDEX_HIGH + menuDepth_ - 1 );
|
||||||
|
menu->triggerAttractExitEvent( MENU_INDEX_HIGH + menuDepth_ - 1 );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
menu->triggerEvent( "attractExit", menuDepth_ - 1 );
|
||||||
|
menu->triggerAttractExitEvent( menuDepth_ - 1 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(std::vector<Component *>::iterator it = LayerComponents.begin(); it != LayerComponents.end(); ++it)
|
||||||
|
{
|
||||||
|
(*it)->triggerEvent( "attractExit", menuDepth_ - 1 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Page::triggerEvent( std::string action )
|
void Page::triggerEvent( std::string action )
|
||||||
{
|
{
|
||||||
for(std::vector<Component *>::iterator it = LayerComponents.begin(); it != LayerComponents.end(); ++it)
|
for(std::vector<Component *>::iterator it = LayerComponents.begin(); it != LayerComponents.end(); ++it)
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ public:
|
|||||||
void setScrollOffsetIndex(unsigned int i);
|
void setScrollOffsetIndex(unsigned int i);
|
||||||
unsigned int getScrollOffsetIndex();
|
unsigned int getScrollOffsetIndex();
|
||||||
bool isIdle();
|
bool isIdle();
|
||||||
|
bool isAttractIdle();
|
||||||
bool isGraphicsIdle();
|
bool isGraphicsIdle();
|
||||||
bool isMenuIdle();
|
bool isMenuIdle();
|
||||||
void setStatusTextComponent(Text *t);
|
void setStatusTextComponent(Text *t);
|
||||||
@@ -106,6 +107,9 @@ public:
|
|||||||
void playlistExit();
|
void playlistExit();
|
||||||
void menuJumpEnter();
|
void menuJumpEnter();
|
||||||
void menuJumpExit();
|
void menuJumpExit();
|
||||||
|
void attractEnter( );
|
||||||
|
void attract( );
|
||||||
|
void attractExit( );
|
||||||
void triggerEvent( std::string action );
|
void triggerEvent( std::string action );
|
||||||
void setText( std::string text, int id );
|
void setText( std::string text, int id );
|
||||||
void addPlaylist();
|
void addPlaylist();
|
||||||
|
|||||||
@@ -868,6 +868,9 @@ AnimationEvents *PageBuilder::createTweenInstance(xml_node<> *componentXml)
|
|||||||
buildTweenSet(tweens, componentXml, "onPlaylistExit", "playlistExit");
|
buildTweenSet(tweens, componentXml, "onPlaylistExit", "playlistExit");
|
||||||
buildTweenSet(tweens, componentXml, "onMenuJumpEnter", "menuJumpEnter");
|
buildTweenSet(tweens, componentXml, "onMenuJumpEnter", "menuJumpEnter");
|
||||||
buildTweenSet(tweens, componentXml, "onMenuJumpExit", "menuJumpExit");
|
buildTweenSet(tweens, componentXml, "onMenuJumpExit", "menuJumpExit");
|
||||||
|
buildTweenSet(tweens, componentXml, "onAttractEnter", "attractEnter");
|
||||||
|
buildTweenSet(tweens, componentXml, "onAttract", "attract");
|
||||||
|
buildTweenSet(tweens, componentXml, "onAttractExit", "attractExit");
|
||||||
|
|
||||||
buildTweenSet(tweens, componentXml, "onMenuActionInputEnter", "menuActionInputEnter");
|
buildTweenSet(tweens, componentXml, "onMenuActionInputEnter", "menuActionInputEnter");
|
||||||
buildTweenSet(tweens, componentXml, "onMenuActionInputExit", "menuActionInputExit");
|
buildTweenSet(tweens, componentXml, "onMenuActionInputExit", "menuActionInputExit");
|
||||||
|
|||||||
@@ -70,7 +70,8 @@ RetroFE::RetroFE( Configuration &c )
|
|||||||
, keyLastTime_(0)
|
, keyLastTime_(0)
|
||||||
, keyDelayTime_(.3f)
|
, keyDelayTime_(.3f)
|
||||||
{
|
{
|
||||||
menuMode_ = false;
|
menuMode_ = false;
|
||||||
|
attractMode_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1136,6 +1137,22 @@ void RetroFE::run( )
|
|||||||
currentPage_->nextPlaylist( );
|
currentPage_->nextPlaylist( );
|
||||||
state = RETROFE_PLAYLIST_REQUEST;
|
state = RETROFE_PLAYLIST_REQUEST;
|
||||||
}
|
}
|
||||||
|
if ( currentPage_->isAttractIdle( ) )
|
||||||
|
{
|
||||||
|
if ( !attractMode_ && attract_.isSet( ) )
|
||||||
|
{
|
||||||
|
currentPage_->attractEnter( );
|
||||||
|
}
|
||||||
|
else if ( attractMode_ && !attract_.isSet( ) )
|
||||||
|
{
|
||||||
|
currentPage_->attractExit( );
|
||||||
|
}
|
||||||
|
else if ( attract_.isSet( ) )
|
||||||
|
{
|
||||||
|
currentPage_->attract( );
|
||||||
|
}
|
||||||
|
attractMode_ = attract_.isSet( );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ( menuMode_ )
|
if ( menuMode_ )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -129,6 +129,7 @@ private:
|
|||||||
FontCache fontcache_;
|
FontCache fontcache_;
|
||||||
AttractMode attract_;
|
AttractMode attract_;
|
||||||
bool menuMode_;
|
bool menuMode_;
|
||||||
|
bool attractMode_;
|
||||||
|
|
||||||
std::map<std::string, unsigned int> lastMenuOffsets_;
|
std::map<std::string, unsigned int> lastMenuOffsets_;
|
||||||
std::map<std::string, std::string> lastMenuPlaylists_;
|
std::map<std::string, std::string> lastMenuPlaylists_;
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
std::string retrofe_version_major = "0";
|
std::string retrofe_version_major = "0";
|
||||||
std::string retrofe_version_minor = "9";
|
std::string retrofe_version_minor = "9";
|
||||||
std::string retrofe_version_build = "6";
|
std::string retrofe_version_build = "7";
|
||||||
|
|
||||||
|
|
||||||
std::string Version::getString( )
|
std::string Version::getString( )
|
||||||
|
|||||||
Reference in New Issue
Block a user