mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2026-01-26 17:54:46 +01:00
Add key to randomly highlight a game
This commit is contained in:
parent
e438ccfc2e
commit
bf1286653a
@ -7,6 +7,7 @@ pageDown = B
|
||||
letterUp = N
|
||||
letterDown = M
|
||||
nextPlaylist = P
|
||||
random = R
|
||||
select = Space
|
||||
back = Escape
|
||||
quit = Q
|
||||
|
||||
@ -74,6 +74,7 @@ bool UserInput::initialize()
|
||||
retVal = MapKey("back", KeyCodeBack) && retVal;
|
||||
retVal = MapKey("quit", KeyCodeQuit) && retVal;
|
||||
MapKey("nextPlaylist", KeyCodeNextPlaylist);
|
||||
MapKey("random", KeyCodeRandom);
|
||||
// these features will need to be implemented at a later time
|
||||
// retVal = MapKey("admin", KeyCodeAdminMode) && retVal;
|
||||
// retVal = MapKey("remove", KeyCodeHideItem) && retVal;
|
||||
|
||||
@ -40,6 +40,7 @@ public:
|
||||
KeyCodeLetterDown,
|
||||
KeyCodeLetterUp,
|
||||
KeyCodeNextPlaylist,
|
||||
KeyCodeRandom,
|
||||
KeyCodeAdminMode,
|
||||
KeyCodeHideItem,
|
||||
KeyCodeQuit,
|
||||
|
||||
@ -292,6 +292,14 @@ void ScrollingList::pageDown()
|
||||
allocateSpritePoints();
|
||||
}
|
||||
|
||||
void ScrollingList::random()
|
||||
{
|
||||
if(!items_ || items_->size() == 0) return;
|
||||
|
||||
deallocateSpritePoints();
|
||||
itemIndex_ = rand() % items_->size();
|
||||
allocateSpritePoints();
|
||||
}
|
||||
|
||||
void ScrollingList::letterUp()
|
||||
{
|
||||
|
||||
@ -65,6 +65,7 @@ public:
|
||||
void letterUp();
|
||||
void letterDown();
|
||||
void letterChange(bool increment);
|
||||
void random();
|
||||
bool isIdle();
|
||||
unsigned int getScrollOffsetIndex();
|
||||
void setScrollOffsetIndex(unsigned int index);
|
||||
|
||||
@ -407,6 +407,11 @@ void Page::pageScroll(ScrollDirection direction)
|
||||
}
|
||||
}
|
||||
|
||||
void Page::selectRandom()
|
||||
{
|
||||
if(activeMenu_) activeMenu_->random();
|
||||
}
|
||||
|
||||
void Page::letterScroll(ScrollDirection direction)
|
||||
{
|
||||
if(activeMenu_)
|
||||
|
||||
@ -56,6 +56,7 @@ public:
|
||||
bool addComponent(Component *c);
|
||||
void pageScroll(ScrollDirection direction);
|
||||
void letterScroll(ScrollDirection direction);
|
||||
void selectRandom();
|
||||
void start();
|
||||
void startComponents();
|
||||
void stop();
|
||||
|
||||
@ -448,7 +448,8 @@ RetroFE::RETROFE_STATE RetroFE::processUserInput(Page *page)
|
||||
!input_.keystate(UserInput::KeyCodePageDown) &&
|
||||
!input_.keystate(UserInput::KeyCodeLetterUp) &&
|
||||
!input_.keystate(UserInput::KeyCodeLetterDown) &&
|
||||
!input_.keystate(UserInput::KeyCodeNextPlaylist))
|
||||
!input_.keystate(UserInput::KeyCodeNextPlaylist) &&
|
||||
!input_.keystate(UserInput::KeyCodeRandom))
|
||||
{
|
||||
keyLastTime_ = 0;
|
||||
keyDelayTime_= 0.3f;
|
||||
@ -480,6 +481,10 @@ RetroFE::RETROFE_STATE RetroFE::processUserInput(Page *page)
|
||||
{
|
||||
page->nextPlaylist();
|
||||
}
|
||||
if(input_.keystate(UserInput::KeyCodeRandom))
|
||||
{
|
||||
page->selectRandom();
|
||||
}
|
||||
}
|
||||
|
||||
if (input_.keystate(UserInput::KeyCodeAdminMode))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user