mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2026-01-23 16:24:54 +01:00
Added nextCyclePlaylist and prevCyclePlaylist keys.
This commit is contained in:
parent
999d9747e9
commit
031d937ec7
@ -63,6 +63,8 @@ bool UserInput::initialize()
|
|||||||
MapKey("nextPlaylist", KeyCodeNextPlaylist, false);
|
MapKey("nextPlaylist", KeyCodeNextPlaylist, false);
|
||||||
MapKey("prevPlaylist", KeyCodePrevPlaylist, false);
|
MapKey("prevPlaylist", KeyCodePrevPlaylist, false);
|
||||||
MapKey("cyclePlaylist", KeyCodeCyclePlaylist, false);
|
MapKey("cyclePlaylist", KeyCodeCyclePlaylist, false);
|
||||||
|
MapKey("nextCyclePlaylist", KeyCodeNextCyclePlaylist, false);
|
||||||
|
MapKey("prevCyclePlaylist", KeyCodePrevCyclePlaylist, false);
|
||||||
MapKey("addPlaylist", KeyCodeAddPlaylist, false);
|
MapKey("addPlaylist", KeyCodeAddPlaylist, false);
|
||||||
MapKey("removePlaylist", KeyCodeRemovePlaylist, false);
|
MapKey("removePlaylist", KeyCodeRemovePlaylist, false);
|
||||||
MapKey("random", KeyCodeRandom, false);
|
MapKey("random", KeyCodeRandom, false);
|
||||||
|
|||||||
@ -47,6 +47,8 @@ public:
|
|||||||
KeyCodeNextPlaylist,
|
KeyCodeNextPlaylist,
|
||||||
KeyCodePrevPlaylist,
|
KeyCodePrevPlaylist,
|
||||||
KeyCodeCyclePlaylist,
|
KeyCodeCyclePlaylist,
|
||||||
|
KeyCodeNextCyclePlaylist,
|
||||||
|
KeyCodePrevCyclePlaylist,
|
||||||
KeyCodeRandom,
|
KeyCodeRandom,
|
||||||
KeyCodeMenu,
|
KeyCodeMenu,
|
||||||
KeyCodeAddPlaylist,
|
KeyCodeAddPlaylist,
|
||||||
|
|||||||
@ -1193,7 +1193,7 @@ void Page::selectPlaylist(std::string playlist)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Page::cyclePlaylist(std::vector<std::string> list)
|
void Page::nextCyclePlaylist(std::vector<std::string> list)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Empty list
|
// Empty list
|
||||||
@ -1231,6 +1231,44 @@ void Page::cyclePlaylist(std::vector<std::string> list)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Page::prevCyclePlaylist(std::vector<std::string> list)
|
||||||
|
{
|
||||||
|
|
||||||
|
// Empty list
|
||||||
|
if (list.size() == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Find the current playlist in the list
|
||||||
|
std::vector<std::string>::iterator it = list.begin();
|
||||||
|
while (*it != getPlaylistName() && it != list.end())
|
||||||
|
++it;
|
||||||
|
|
||||||
|
// If current playlist not found, switch to the last found cycle playlist in the playlist list
|
||||||
|
if (it == list.end())
|
||||||
|
{
|
||||||
|
for (std::vector<std::string>::iterator it2 = list.end(); it2 != list.begin(); --it2)
|
||||||
|
{
|
||||||
|
selectPlaylist( *it2 );
|
||||||
|
if (*it2 == getPlaylistName())
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Current playlist found; switch to the previous found playlist in the list
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for(;;)
|
||||||
|
{
|
||||||
|
--it;
|
||||||
|
if (it == list.begin()) it = list.end(); // wrap
|
||||||
|
selectPlaylist( *it );
|
||||||
|
if (*it == getPlaylistName())
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Page::update(float dt)
|
void Page::update(float dt)
|
||||||
{
|
{
|
||||||
for(MenuVector_T::iterator it = menus_.begin(); it != menus_.end(); it++)
|
for(MenuVector_T::iterator it = menus_.begin(); it != menus_.end(); it++)
|
||||||
|
|||||||
@ -57,7 +57,8 @@ public:
|
|||||||
void nextPlaylist();
|
void nextPlaylist();
|
||||||
void prevPlaylist();
|
void prevPlaylist();
|
||||||
void selectPlaylist(std::string playlist);
|
void selectPlaylist(std::string playlist);
|
||||||
void cyclePlaylist(std::vector<std::string> list);
|
void nextCyclePlaylist(std::vector<std::string> list);
|
||||||
|
void prevCyclePlaylist(std::vector<std::string> list);
|
||||||
void pushMenu(ScrollingList *s, int index = -1);
|
void pushMenu(ScrollingList *s, int index = -1);
|
||||||
bool isMenusFull();
|
bool isMenusFull();
|
||||||
void setLoadSound(Sound *chunk);
|
void setLoadSound(Sound *chunk);
|
||||||
|
|||||||
@ -1346,6 +1346,8 @@ RetroFE::RETROFE_STATE RetroFE::processUserInput( Page *page )
|
|||||||
!input_.keystate(UserInput::KeyCodeNextPlaylist) &&
|
!input_.keystate(UserInput::KeyCodeNextPlaylist) &&
|
||||||
!input_.keystate(UserInput::KeyCodePrevPlaylist) &&
|
!input_.keystate(UserInput::KeyCodePrevPlaylist) &&
|
||||||
!input_.keystate(UserInput::KeyCodeCyclePlaylist) &&
|
!input_.keystate(UserInput::KeyCodeCyclePlaylist) &&
|
||||||
|
!input_.keystate(UserInput::KeyCodeNextCyclePlaylist) &&
|
||||||
|
!input_.keystate(UserInput::KeyCodePrevCyclePlaylist) &&
|
||||||
!input_.keystate(UserInput::KeyCodeAddPlaylist) &&
|
!input_.keystate(UserInput::KeyCodeAddPlaylist) &&
|
||||||
!input_.keystate(UserInput::KeyCodeRemovePlaylist) &&
|
!input_.keystate(UserInput::KeyCodeRemovePlaylist) &&
|
||||||
!input_.keystate(UserInput::KeyCodeRandom) &&
|
!input_.keystate(UserInput::KeyCodeRandom) &&
|
||||||
@ -1413,14 +1415,25 @@ RetroFE::RETROFE_STATE RetroFE::processUserInput( Page *page )
|
|||||||
page->prevPlaylist( );
|
page->prevPlaylist( );
|
||||||
state = RETROFE_PLAYLIST_REQUEST;
|
state = RETROFE_PLAYLIST_REQUEST;
|
||||||
}
|
}
|
||||||
if ( input_.keystate(UserInput::KeyCodeCyclePlaylist) )
|
if ( input_.keystate(UserInput::KeyCodeCyclePlaylist) ||
|
||||||
|
input_.keystate(UserInput::KeyCodeNextCyclePlaylist) )
|
||||||
{
|
{
|
||||||
attract_.reset( );
|
attract_.reset( );
|
||||||
std::string cycleString;
|
std::string cycleString;
|
||||||
config_.getProperty( "cyclePlaylist", cycleString );
|
config_.getProperty( "cyclePlaylist", cycleString );
|
||||||
std::vector<std::string> cycleVector;
|
std::vector<std::string> cycleVector;
|
||||||
Utils::listToVector( cycleString, cycleVector, ',' );
|
Utils::listToVector( cycleString, cycleVector, ',' );
|
||||||
page->cyclePlaylist( cycleVector );
|
page->nextCyclePlaylist( cycleVector );
|
||||||
|
state = RETROFE_PLAYLIST_REQUEST;
|
||||||
|
}
|
||||||
|
if ( input_.keystate(UserInput::KeyCodePrevCyclePlaylist) )
|
||||||
|
{
|
||||||
|
attract_.reset( );
|
||||||
|
std::string cycleString;
|
||||||
|
config_.getProperty( "cyclePlaylist", cycleString );
|
||||||
|
std::vector<std::string> cycleVector;
|
||||||
|
Utils::listToVector( cycleString, cycleVector, ',' );
|
||||||
|
page->prevCyclePlaylist( cycleVector );
|
||||||
state = RETROFE_PLAYLIST_REQUEST;
|
state = RETROFE_PLAYLIST_REQUEST;
|
||||||
}
|
}
|
||||||
if ( input_.newKeyPressed(UserInput::KeyCodeRemovePlaylist) )
|
if ( input_.newKeyPressed(UserInput::KeyCodeRemovePlaylist) )
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user