Added onMenuJumpEnter/Exit animation REPLACING onHighlightEnter/Exit

animation for next/previous letter/page and for random selection; basically
a jump within the same scrolling list menu. Layouts should be updated
accordingly.
This commit is contained in:
Pieter Hulshoff 2018-06-23 16:04:48 +02:00 committed by Vincent-FK
parent 63b80e8420
commit 38e88c44d7
8 changed files with 122 additions and 21 deletions

View File

@ -452,6 +452,24 @@ void ScrollingList::triggerPlaylistExitEvent( int menuIndex )
} }
} }
void ScrollingList::triggerMenuJumpEnterEvent( int menuIndex )
{
for ( unsigned int i = 0; i < components_.size( ); ++i )
{
Component *c = components_.at( i );
if ( c ) c->triggerEvent( "menuJumpEnter", menuIndex );
}
}
void ScrollingList::triggerMenuJumpExitEvent( int menuIndex )
{
for ( unsigned int i = 0; i < components_.size( ); ++i )
{
Component *c = components_.at( i );
if ( c ) c->triggerEvent( "menuJumpExit", menuIndex );
}
}
void ScrollingList::update( float dt ) void ScrollingList::update( float dt )
{ {

View File

@ -55,6 +55,8 @@ public:
void triggerHighlightExitEvent( int menuIndex = -1 ); void triggerHighlightExitEvent( int menuIndex = -1 );
void triggerPlaylistEnterEvent( int menuIndex = -1 ); void triggerPlaylistEnterEvent( int menuIndex = -1 );
void triggerPlaylistExitEvent( int menuIndex = -1 ); void triggerPlaylistExitEvent( int menuIndex = -1 );
void triggerMenuJumpEnterEvent( int menuIndex = -1 );
void triggerMenuJumpExitEvent( 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 );

View File

@ -545,6 +545,68 @@ void Page::playlistExit()
} }
void Page::menuJumpEnter()
{
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( "menuJumpEnter", MENU_INDEX_HIGH + menuDepth_ - 1 );
menu->triggerMenuJumpEnterEvent( MENU_INDEX_HIGH + menuDepth_ - 1 );
}
else
{
menu->triggerEvent( "menuJumpEnter", menuDepth_ - 1 );
menu->triggerMenuJumpEnterEvent( menuDepth_ - 1 );
}
}
}
for(std::vector<Component *>::iterator it = LayerComponents.begin(); it != LayerComponents.end(); ++it)
{
(*it)->triggerEvent( "menuJumpEnter", menuDepth_ - 1 );
}
}
void Page::menuJumpExit()
{
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( "menuJumpExit", MENU_INDEX_HIGH + menuDepth_ - 1 );
menu->triggerMenuJumpExitEvent( MENU_INDEX_HIGH + menuDepth_ - 1 );
}
else
{
menu->triggerEvent( "menuJumpExit", menuDepth_ - 1 );
menu->triggerMenuJumpExitEvent( menuDepth_ - 1 );
}
}
}
for(std::vector<Component *>::iterator it = LayerComponents.begin(); it != LayerComponents.end(); ++it)
{
(*it)->triggerEvent( "menuJumpExit", 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)

View File

@ -100,6 +100,8 @@ public:
void highlightExit(); void highlightExit();
void playlistEnter(); void playlistEnter();
void playlistExit(); void playlistExit();
void menuJumpEnter();
void menuJumpExit();
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();

View File

@ -859,6 +859,8 @@ AnimationEvents *PageBuilder::createTweenInstance(xml_node<> *componentXml)
buildTweenSet(tweens, componentXml, "onGameExit", "gameExit"); buildTweenSet(tweens, componentXml, "onGameExit", "gameExit");
buildTweenSet(tweens, componentXml, "onPlaylistEnter", "playlistEnter"); buildTweenSet(tweens, componentXml, "onPlaylistEnter", "playlistEnter");
buildTweenSet(tweens, componentXml, "onPlaylistExit", "playlistExit"); buildTweenSet(tweens, componentXml, "onPlaylistExit", "playlistExit");
buildTweenSet(tweens, componentXml, "onMenuJumpEnter", "menuJumpEnter");
buildTweenSet(tweens, componentXml, "onMenuJumpExit", "menuJumpExit");
buildTweenSet(tweens, componentXml, "onMenuActionInputEnter", "menuActionInputEnter"); buildTweenSet(tweens, componentXml, "onMenuActionInputEnter", "menuActionInputEnter");
buildTweenSet(tweens, componentXml, "onMenuActionInputExit", "menuActionInputExit"); buildTweenSet(tweens, componentXml, "onMenuActionInputExit", "menuActionInputExit");

View File

@ -494,23 +494,46 @@ void RetroFE::run( )
} }
break; break;
// Make a jump in the menu; start onHighlightExit animation // Jump in menu; start onMenuJumpExit animation
case RETROFE_MENUJUMP_REQUEST: case RETROFE_MENUJUMP_REQUEST:
currentPage_->menuJumpExit( );
currentPage_->setScrolling(Page::ScrollDirectionIdle); currentPage_->setScrolling(Page::ScrollDirectionIdle);
currentPage_->highlightExit( );
state = RETROFE_MENUJUMP_EXIT; state = RETROFE_MENUJUMP_EXIT;
break; break;
// Make a jump in the menu; wait for onHighlightExit animation to finish; load art // Jump in menu; wait for onMenuJumpExit animation to finish; load art
case RETROFE_MENUJUMP_EXIT: case RETROFE_MENUJUMP_EXIT:
if (currentPage_->isMenuIdle( ) && processUserInput( currentPage_ ) == RETROFE_MENUJUMP_REQUEST)
{
state = RETROFE_MENUJUMP_REQUEST;
}
if (currentPage_->isIdle( )) if (currentPage_->isIdle( ))
{ {
currentPage_->highlightLoadArt( ); currentPage_->onNewItemSelected( );
state = RETROFE_HIGHLIGHT_LOAD_ART; state = RETROFE_MENUJUMP_LOAD_ART;
}
break;
// Jump in menu; start onMenuJumpEnter animation
case RETROFE_MENUJUMP_LOAD_ART:
if (currentPage_->isIdle( ))
{
currentPage_->reallocateMenuSpritePoints( );
currentPage_->menuJumpEnter( );
state = RETROFE_MENUJUMP_ENTER;
}
break;
// Jump in menu; wait for onMenuJump animation to finish
case RETROFE_MENUJUMP_ENTER:
if (currentPage_->isIdle( ))
{
bool collectionInputClear = false;
config_.getProperty( "collectionInputClear", collectionInputClear );
if ( collectionInputClear )
{
// Empty event queue
SDL_Event e;
while ( SDL_PollEvent( &e ) );
input_.resetStates( );
}
state = RETROFE_IDLE;
} }
break; break;
@ -996,32 +1019,24 @@ RetroFE::RETROFE_STATE RetroFE::processUserInput( Page *page )
{ {
attract_.reset( ); attract_.reset( );
page->pageScroll(Page::ScrollDirectionBack); page->pageScroll(Page::ScrollDirectionBack);
page->onNewItemSelected( );
page->reallocateMenuSpritePoints( );
state = RETROFE_MENUJUMP_REQUEST; state = RETROFE_MENUJUMP_REQUEST;
} }
if (input_.keystate(UserInput::KeyCodePageDown)) if (input_.keystate(UserInput::KeyCodePageDown))
{ {
attract_.reset( ); attract_.reset( );
page->pageScroll(Page::ScrollDirectionForward); page->pageScroll(Page::ScrollDirectionForward);
page->onNewItemSelected( );
page->reallocateMenuSpritePoints( );
state = RETROFE_MENUJUMP_REQUEST; state = RETROFE_MENUJUMP_REQUEST;
} }
if (input_.keystate(UserInput::KeyCodeLetterUp)) if (input_.keystate(UserInput::KeyCodeLetterUp))
{ {
attract_.reset( ); attract_.reset( );
page->letterScroll(Page::ScrollDirectionBack); page->letterScroll(Page::ScrollDirectionBack);
page->onNewItemSelected( );
page->reallocateMenuSpritePoints( );
state = RETROFE_MENUJUMP_REQUEST; state = RETROFE_MENUJUMP_REQUEST;
} }
if (input_.keystate(UserInput::KeyCodeLetterDown)) if (input_.keystate(UserInput::KeyCodeLetterDown))
{ {
attract_.reset( ); attract_.reset( );
page->letterScroll(Page::ScrollDirectionForward); page->letterScroll(Page::ScrollDirectionForward);
page->onNewItemSelected( );
page->reallocateMenuSpritePoints( );
state = RETROFE_MENUJUMP_REQUEST; state = RETROFE_MENUJUMP_REQUEST;
} }
if ( input_.newKeyPressed(UserInput::KeyCodeFavPlaylist) ) if ( input_.newKeyPressed(UserInput::KeyCodeFavPlaylist) )
@ -1058,9 +1073,7 @@ RetroFE::RETROFE_STATE RetroFE::processUserInput( Page *page )
{ {
attract_.reset( ); attract_.reset( );
page->selectRandom( ); page->selectRandom( );
page->onNewItemSelected( ); state = RETROFE_MENUJUMP_REQUEST;
page->reallocateMenuSpritePoints( );
state = RETROFE_HIGHLIGHT_REQUEST;
} }
} }

View File

@ -68,6 +68,8 @@ private:
RETROFE_PLAYLIST_ENTER, RETROFE_PLAYLIST_ENTER,
RETROFE_MENUJUMP_REQUEST, RETROFE_MENUJUMP_REQUEST,
RETROFE_MENUJUMP_EXIT, RETROFE_MENUJUMP_EXIT,
RETROFE_MENUJUMP_LOAD_ART,
RETROFE_MENUJUMP_ENTER,
RETROFE_HIGHLIGHT_REQUEST, RETROFE_HIGHLIGHT_REQUEST,
RETROFE_HIGHLIGHT_EXIT, RETROFE_HIGHLIGHT_EXIT,
RETROFE_HIGHLIGHT_LOAD_ART, RETROFE_HIGHLIGHT_LOAD_ART,

View File

@ -21,7 +21,7 @@
std::string retrofe_version_major = "0"; std::string retrofe_version_major = "0";
std::string retrofe_version_minor = "8"; std::string retrofe_version_minor = "8";
std::string retrofe_version_build = "16"; std::string retrofe_version_build = "17";
std::string Version::getString( ) std::string Version::getString( )