mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2025-12-12 17:58:53 +01:00
Allow menu direction scroll change independent of the idle state of the menu.
This commit is contained in:
parent
f98395cbcd
commit
fa44e571c9
@ -575,132 +575,133 @@ RetroFE::RETROFE_STATE RetroFE::processUserInput(Page *page)
|
|||||||
bool exit = false;
|
bool exit = false;
|
||||||
RETROFE_STATE state = RETROFE_IDLE;
|
RETROFE_STATE state = RETROFE_IDLE;
|
||||||
|
|
||||||
|
if(page->isHorizontalScroll())
|
||||||
|
{
|
||||||
|
if (input_.keystate(UserInput::KeyCodeLeft))
|
||||||
|
{
|
||||||
|
page->setScrolling(Page::ScrollDirectionBack);
|
||||||
|
}
|
||||||
|
if (input_.keystate(UserInput::KeyCodeRight))
|
||||||
|
{
|
||||||
|
page->setScrolling(Page::ScrollDirectionForward);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (input_.keystate(UserInput::KeyCodeUp))
|
||||||
|
{
|
||||||
|
page->setScrolling(Page::ScrollDirectionBack);
|
||||||
|
}
|
||||||
|
if (input_.keystate(UserInput::KeyCodeDown))
|
||||||
|
{
|
||||||
|
page->setScrolling(Page::ScrollDirectionForward);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(page->isMenuIdle())
|
if(page->isMenuIdle())
|
||||||
{
|
{
|
||||||
if(page->isHorizontalScroll())
|
|
||||||
|
if (!input_.keystate(UserInput::KeyCodePageUp) &&
|
||||||
|
!input_.keystate(UserInput::KeyCodePageDown) &&
|
||||||
|
!input_.keystate(UserInput::KeyCodeLetterUp) &&
|
||||||
|
!input_.keystate(UserInput::KeyCodeLetterDown) &&
|
||||||
|
!input_.keystate(UserInput::KeyCodeNextPlaylist) &&
|
||||||
|
!input_.keystate(UserInput::KeyCodeAddPlaylist) &&
|
||||||
|
!input_.keystate(UserInput::KeyCodeRemovePlaylist) &&
|
||||||
|
!input_.keystate(UserInput::KeyCodeRandom))
|
||||||
{
|
{
|
||||||
if (input_.keystate(UserInput::KeyCodeLeft))
|
keyLastTime_ = 0;
|
||||||
{
|
keyDelayTime_= 0.3f;
|
||||||
page->setScrolling(Page::ScrollDirectionBack);
|
|
||||||
}
|
|
||||||
if (input_.keystate(UserInput::KeyCodeRight))
|
|
||||||
{
|
|
||||||
page->setScrolling(Page::ScrollDirectionForward);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
else if((currentTime_ - keyLastTime_) > keyDelayTime_ || keyLastTime_ == 0)
|
||||||
{
|
{
|
||||||
if (input_.keystate(UserInput::KeyCodeUp))
|
keyLastTime_ = currentTime_;
|
||||||
|
keyDelayTime_-= .05f;
|
||||||
|
if(keyDelayTime_< 0.1f) keyDelayTime_= 0.1f;
|
||||||
|
|
||||||
|
if (input_.keystate(UserInput::KeyCodePageUp))
|
||||||
{
|
{
|
||||||
page->setScrolling(Page::ScrollDirectionBack);
|
page->pageScroll(Page::ScrollDirectionBack);
|
||||||
|
page->reallocateMenuSpritePoints();
|
||||||
|
state = RETROFE_HIGHLIGHT_REQUEST;
|
||||||
}
|
}
|
||||||
if (input_.keystate(UserInput::KeyCodeDown))
|
if (input_.keystate(UserInput::KeyCodePageDown))
|
||||||
{
|
{
|
||||||
page->setScrolling(Page::ScrollDirectionForward);
|
page->pageScroll(Page::ScrollDirectionForward);
|
||||||
|
page->reallocateMenuSpritePoints();
|
||||||
|
state = RETROFE_HIGHLIGHT_REQUEST;
|
||||||
|
}
|
||||||
|
if (input_.keystate(UserInput::KeyCodeLetterUp))
|
||||||
|
{
|
||||||
|
page->letterScroll(Page::ScrollDirectionBack);
|
||||||
|
page->reallocateMenuSpritePoints();
|
||||||
|
state = RETROFE_HIGHLIGHT_REQUEST;
|
||||||
|
}
|
||||||
|
if (input_.keystate(UserInput::KeyCodeLetterDown))
|
||||||
|
{
|
||||||
|
page->letterScroll(Page::ScrollDirectionForward);
|
||||||
|
page->reallocateMenuSpritePoints();
|
||||||
|
state = RETROFE_HIGHLIGHT_REQUEST;
|
||||||
|
}
|
||||||
|
if(input_.newKeyPressed(UserInput::KeyCodeNextPlaylist))
|
||||||
|
{
|
||||||
|
page->nextPlaylist();
|
||||||
|
page->reallocateMenuSpritePoints();
|
||||||
|
state = RETROFE_HIGHLIGHT_REQUEST;
|
||||||
|
}
|
||||||
|
if(input_.newKeyPressed(UserInput::KeyCodeRemovePlaylist))
|
||||||
|
{
|
||||||
|
page->removePlaylist();
|
||||||
|
page->onNewItemSelected();
|
||||||
|
page->reallocateMenuSpritePoints();
|
||||||
|
}
|
||||||
|
if(input_.newKeyPressed(UserInput::KeyCodeAddPlaylist))
|
||||||
|
{
|
||||||
|
page->addPlaylist();
|
||||||
|
page->reallocateMenuSpritePoints();
|
||||||
|
}
|
||||||
|
if(input_.keystate(UserInput::KeyCodeRandom))
|
||||||
|
{
|
||||||
|
page->selectRandom();
|
||||||
|
page->reallocateMenuSpritePoints();
|
||||||
|
state = RETROFE_HIGHLIGHT_REQUEST;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!input_.keystate(UserInput::KeyCodePageUp) &&
|
if (input_.keystate(UserInput::KeyCodeAdminMode))
|
||||||
!input_.keystate(UserInput::KeyCodePageDown) &&
|
{
|
||||||
!input_.keystate(UserInput::KeyCodeLetterUp) &&
|
//todo: add admin mode support
|
||||||
!input_.keystate(UserInput::KeyCodeLetterDown) &&
|
}
|
||||||
!input_.keystate(UserInput::KeyCodeNextPlaylist) &&
|
if (input_.keystate(UserInput::KeyCodeSelect))
|
||||||
!input_.keystate(UserInput::KeyCodeAddPlaylist) &&
|
{
|
||||||
!input_.keystate(UserInput::KeyCodeRemovePlaylist) &&
|
nextPageItem_ = page->getSelectedItem();
|
||||||
!input_.keystate(UserInput::KeyCodeRandom))
|
|
||||||
{
|
|
||||||
keyLastTime_ = 0;
|
|
||||||
keyDelayTime_= 0.3f;
|
|
||||||
}
|
|
||||||
|
|
||||||
else if((currentTime_ - keyLastTime_) > keyDelayTime_ || keyLastTime_ == 0)
|
if(nextPageItem_)
|
||||||
{
|
|
||||||
keyLastTime_ = currentTime_;
|
|
||||||
keyDelayTime_-= .05f;
|
|
||||||
if(keyDelayTime_< 0.1f) keyDelayTime_= 0.1f;
|
|
||||||
|
|
||||||
if (input_.keystate(UserInput::KeyCodePageUp))
|
|
||||||
{
|
|
||||||
page->pageScroll(Page::ScrollDirectionBack);
|
|
||||||
page->reallocateMenuSpritePoints();
|
|
||||||
state = RETROFE_HIGHLIGHT_REQUEST;
|
|
||||||
}
|
|
||||||
if (input_.keystate(UserInput::KeyCodePageDown))
|
|
||||||
{
|
|
||||||
page->pageScroll(Page::ScrollDirectionForward);
|
|
||||||
page->reallocateMenuSpritePoints();
|
|
||||||
state = RETROFE_HIGHLIGHT_REQUEST;
|
|
||||||
}
|
|
||||||
if (input_.keystate(UserInput::KeyCodeLetterUp))
|
|
||||||
{
|
|
||||||
page->letterScroll(Page::ScrollDirectionBack);
|
|
||||||
page->reallocateMenuSpritePoints();
|
|
||||||
state = RETROFE_HIGHLIGHT_REQUEST;
|
|
||||||
}
|
|
||||||
if (input_.keystate(UserInput::KeyCodeLetterDown))
|
|
||||||
{
|
|
||||||
page->letterScroll(Page::ScrollDirectionForward);
|
|
||||||
page->reallocateMenuSpritePoints();
|
|
||||||
state = RETROFE_HIGHLIGHT_REQUEST;
|
|
||||||
}
|
|
||||||
if(input_.newKeyPressed(UserInput::KeyCodeNextPlaylist))
|
|
||||||
{
|
|
||||||
page->nextPlaylist();
|
|
||||||
page->reallocateMenuSpritePoints();
|
|
||||||
state = RETROFE_HIGHLIGHT_REQUEST;
|
|
||||||
}
|
|
||||||
if(input_.newKeyPressed(UserInput::KeyCodeRemovePlaylist))
|
|
||||||
{
|
|
||||||
page->removePlaylist();
|
|
||||||
page->onNewItemSelected();
|
|
||||||
page->reallocateMenuSpritePoints();
|
|
||||||
}
|
|
||||||
if(input_.newKeyPressed(UserInput::KeyCodeAddPlaylist))
|
|
||||||
{
|
|
||||||
page->addPlaylist();
|
|
||||||
page->reallocateMenuSpritePoints();
|
|
||||||
}
|
|
||||||
if(input_.keystate(UserInput::KeyCodeRandom))
|
|
||||||
{
|
|
||||||
page->selectRandom();
|
|
||||||
page->reallocateMenuSpritePoints();
|
|
||||||
state = RETROFE_HIGHLIGHT_REQUEST;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (input_.keystate(UserInput::KeyCodeAdminMode))
|
|
||||||
{
|
|
||||||
//todo: add admin mode support
|
|
||||||
}
|
|
||||||
if (input_.keystate(UserInput::KeyCodeSelect))
|
|
||||||
{
|
|
||||||
nextPageItem_ = page->getSelectedItem();
|
|
||||||
|
|
||||||
if(nextPageItem_)
|
|
||||||
{
|
|
||||||
if(nextPageItem_->leaf)
|
|
||||||
{
|
{
|
||||||
state = RETROFE_LAUNCH_REQUEST;
|
if(nextPageItem_->leaf)
|
||||||
}
|
{
|
||||||
else
|
state = RETROFE_LAUNCH_REQUEST;
|
||||||
{
|
}
|
||||||
state = RETROFE_NEXT_PAGE_REQUEST;
|
else
|
||||||
|
{
|
||||||
|
state = RETROFE_NEXT_PAGE_REQUEST;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (input_.keystate(UserInput::KeyCodeBack))
|
if (input_.keystate(UserInput::KeyCodeBack))
|
||||||
{
|
|
||||||
if(back(exit) || exit)
|
|
||||||
{
|
{
|
||||||
state = (exit) ? RETROFE_QUIT_REQUEST : RETROFE_BACK_REQUEST;
|
if(back(exit) || exit)
|
||||||
|
{
|
||||||
|
state = (exit) ? RETROFE_QUIT_REQUEST : RETROFE_BACK_REQUEST;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (input_.keystate(UserInput::KeyCodeQuit))
|
if (input_.keystate(UserInput::KeyCodeQuit))
|
||||||
{
|
{
|
||||||
state = RETROFE_QUIT_REQUEST;
|
state = RETROFE_QUIT_REQUEST;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!input_.keystate(UserInput::KeyCodeUp) &&
|
if(!input_.keystate(UserInput::KeyCodeUp) &&
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user