mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2025-12-12 09:48:51 +01:00
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:
parent
63b80e8420
commit
38e88c44d7
@ -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 )
|
||||
{
|
||||
|
||||
|
||||
@ -55,6 +55,8 @@ public:
|
||||
void triggerHighlightExitEvent( int menuIndex = -1 );
|
||||
void triggerPlaylistEnterEvent( 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 );
|
||||
void deallocateTexture( unsigned int index );
|
||||
|
||||
@ -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 )
|
||||
{
|
||||
for(std::vector<Component *>::iterator it = LayerComponents.begin(); it != LayerComponents.end(); ++it)
|
||||
|
||||
@ -100,6 +100,8 @@ public:
|
||||
void highlightExit();
|
||||
void playlistEnter();
|
||||
void playlistExit();
|
||||
void menuJumpEnter();
|
||||
void menuJumpExit();
|
||||
void triggerEvent( std::string action );
|
||||
void setText( std::string text, int id );
|
||||
void addPlaylist();
|
||||
|
||||
@ -859,6 +859,8 @@ AnimationEvents *PageBuilder::createTweenInstance(xml_node<> *componentXml)
|
||||
buildTweenSet(tweens, componentXml, "onGameExit", "gameExit");
|
||||
buildTweenSet(tweens, componentXml, "onPlaylistEnter", "playlistEnter");
|
||||
buildTweenSet(tweens, componentXml, "onPlaylistExit", "playlistExit");
|
||||
buildTweenSet(tweens, componentXml, "onMenuJumpEnter", "menuJumpEnter");
|
||||
buildTweenSet(tweens, componentXml, "onMenuJumpExit", "menuJumpExit");
|
||||
|
||||
buildTweenSet(tweens, componentXml, "onMenuActionInputEnter", "menuActionInputEnter");
|
||||
buildTweenSet(tweens, componentXml, "onMenuActionInputExit", "menuActionInputExit");
|
||||
|
||||
@ -494,23 +494,46 @@ void RetroFE::run( )
|
||||
}
|
||||
break;
|
||||
|
||||
// Make a jump in the menu; start onHighlightExit animation
|
||||
// Jump in menu; start onMenuJumpExit animation
|
||||
case RETROFE_MENUJUMP_REQUEST:
|
||||
currentPage_->menuJumpExit( );
|
||||
currentPage_->setScrolling(Page::ScrollDirectionIdle);
|
||||
currentPage_->highlightExit( );
|
||||
state = RETROFE_MENUJUMP_EXIT;
|
||||
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:
|
||||
if (currentPage_->isMenuIdle( ) && processUserInput( currentPage_ ) == RETROFE_MENUJUMP_REQUEST)
|
||||
{
|
||||
state = RETROFE_MENUJUMP_REQUEST;
|
||||
}
|
||||
if (currentPage_->isIdle( ))
|
||||
{
|
||||
currentPage_->highlightLoadArt( );
|
||||
state = RETROFE_HIGHLIGHT_LOAD_ART;
|
||||
currentPage_->onNewItemSelected( );
|
||||
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;
|
||||
|
||||
@ -996,32 +1019,24 @@ RetroFE::RETROFE_STATE RetroFE::processUserInput( Page *page )
|
||||
{
|
||||
attract_.reset( );
|
||||
page->pageScroll(Page::ScrollDirectionBack);
|
||||
page->onNewItemSelected( );
|
||||
page->reallocateMenuSpritePoints( );
|
||||
state = RETROFE_MENUJUMP_REQUEST;
|
||||
}
|
||||
if (input_.keystate(UserInput::KeyCodePageDown))
|
||||
{
|
||||
attract_.reset( );
|
||||
page->pageScroll(Page::ScrollDirectionForward);
|
||||
page->onNewItemSelected( );
|
||||
page->reallocateMenuSpritePoints( );
|
||||
state = RETROFE_MENUJUMP_REQUEST;
|
||||
}
|
||||
if (input_.keystate(UserInput::KeyCodeLetterUp))
|
||||
{
|
||||
attract_.reset( );
|
||||
page->letterScroll(Page::ScrollDirectionBack);
|
||||
page->onNewItemSelected( );
|
||||
page->reallocateMenuSpritePoints( );
|
||||
state = RETROFE_MENUJUMP_REQUEST;
|
||||
}
|
||||
if (input_.keystate(UserInput::KeyCodeLetterDown))
|
||||
{
|
||||
attract_.reset( );
|
||||
page->letterScroll(Page::ScrollDirectionForward);
|
||||
page->onNewItemSelected( );
|
||||
page->reallocateMenuSpritePoints( );
|
||||
state = RETROFE_MENUJUMP_REQUEST;
|
||||
}
|
||||
if ( input_.newKeyPressed(UserInput::KeyCodeFavPlaylist) )
|
||||
@ -1058,9 +1073,7 @@ RetroFE::RETROFE_STATE RetroFE::processUserInput( Page *page )
|
||||
{
|
||||
attract_.reset( );
|
||||
page->selectRandom( );
|
||||
page->onNewItemSelected( );
|
||||
page->reallocateMenuSpritePoints( );
|
||||
state = RETROFE_HIGHLIGHT_REQUEST;
|
||||
state = RETROFE_MENUJUMP_REQUEST;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -68,6 +68,8 @@ private:
|
||||
RETROFE_PLAYLIST_ENTER,
|
||||
RETROFE_MENUJUMP_REQUEST,
|
||||
RETROFE_MENUJUMP_EXIT,
|
||||
RETROFE_MENUJUMP_LOAD_ART,
|
||||
RETROFE_MENUJUMP_ENTER,
|
||||
RETROFE_HIGHLIGHT_REQUEST,
|
||||
RETROFE_HIGHLIGHT_EXIT,
|
||||
RETROFE_HIGHLIGHT_LOAD_ART,
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
|
||||
std::string retrofe_version_major = "0";
|
||||
std::string retrofe_version_minor = "8";
|
||||
std::string retrofe_version_build = "16";
|
||||
std::string retrofe_version_build = "17";
|
||||
|
||||
|
||||
std::string Version::getString( )
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user