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
|
letterUp = N
|
||||||
letterDown = M
|
letterDown = M
|
||||||
nextPlaylist = P
|
nextPlaylist = P
|
||||||
|
random = R
|
||||||
select = Space
|
select = Space
|
||||||
back = Escape
|
back = Escape
|
||||||
quit = Q
|
quit = Q
|
||||||
|
|||||||
@ -74,6 +74,7 @@ bool UserInput::initialize()
|
|||||||
retVal = MapKey("back", KeyCodeBack) && retVal;
|
retVal = MapKey("back", KeyCodeBack) && retVal;
|
||||||
retVal = MapKey("quit", KeyCodeQuit) && retVal;
|
retVal = MapKey("quit", KeyCodeQuit) && retVal;
|
||||||
MapKey("nextPlaylist", KeyCodeNextPlaylist);
|
MapKey("nextPlaylist", KeyCodeNextPlaylist);
|
||||||
|
MapKey("random", KeyCodeRandom);
|
||||||
// these features will need to be implemented at a later time
|
// these features will need to be implemented at a later time
|
||||||
// retVal = MapKey("admin", KeyCodeAdminMode) && retVal;
|
// retVal = MapKey("admin", KeyCodeAdminMode) && retVal;
|
||||||
// retVal = MapKey("remove", KeyCodeHideItem) && retVal;
|
// retVal = MapKey("remove", KeyCodeHideItem) && retVal;
|
||||||
|
|||||||
@ -40,6 +40,7 @@ public:
|
|||||||
KeyCodeLetterDown,
|
KeyCodeLetterDown,
|
||||||
KeyCodeLetterUp,
|
KeyCodeLetterUp,
|
||||||
KeyCodeNextPlaylist,
|
KeyCodeNextPlaylist,
|
||||||
|
KeyCodeRandom,
|
||||||
KeyCodeAdminMode,
|
KeyCodeAdminMode,
|
||||||
KeyCodeHideItem,
|
KeyCodeHideItem,
|
||||||
KeyCodeQuit,
|
KeyCodeQuit,
|
||||||
|
|||||||
@ -292,6 +292,14 @@ void ScrollingList::pageDown()
|
|||||||
allocateSpritePoints();
|
allocateSpritePoints();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScrollingList::random()
|
||||||
|
{
|
||||||
|
if(!items_ || items_->size() == 0) return;
|
||||||
|
|
||||||
|
deallocateSpritePoints();
|
||||||
|
itemIndex_ = rand() % items_->size();
|
||||||
|
allocateSpritePoints();
|
||||||
|
}
|
||||||
|
|
||||||
void ScrollingList::letterUp()
|
void ScrollingList::letterUp()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -65,6 +65,7 @@ public:
|
|||||||
void letterUp();
|
void letterUp();
|
||||||
void letterDown();
|
void letterDown();
|
||||||
void letterChange(bool increment);
|
void letterChange(bool increment);
|
||||||
|
void random();
|
||||||
bool isIdle();
|
bool isIdle();
|
||||||
unsigned int getScrollOffsetIndex();
|
unsigned int getScrollOffsetIndex();
|
||||||
void setScrollOffsetIndex(unsigned int index);
|
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)
|
void Page::letterScroll(ScrollDirection direction)
|
||||||
{
|
{
|
||||||
if(activeMenu_)
|
if(activeMenu_)
|
||||||
|
|||||||
@ -56,6 +56,7 @@ public:
|
|||||||
bool addComponent(Component *c);
|
bool addComponent(Component *c);
|
||||||
void pageScroll(ScrollDirection direction);
|
void pageScroll(ScrollDirection direction);
|
||||||
void letterScroll(ScrollDirection direction);
|
void letterScroll(ScrollDirection direction);
|
||||||
|
void selectRandom();
|
||||||
void start();
|
void start();
|
||||||
void startComponents();
|
void startComponents();
|
||||||
void stop();
|
void stop();
|
||||||
|
|||||||
@ -448,7 +448,8 @@ RetroFE::RETROFE_STATE RetroFE::processUserInput(Page *page)
|
|||||||
!input_.keystate(UserInput::KeyCodePageDown) &&
|
!input_.keystate(UserInput::KeyCodePageDown) &&
|
||||||
!input_.keystate(UserInput::KeyCodeLetterUp) &&
|
!input_.keystate(UserInput::KeyCodeLetterUp) &&
|
||||||
!input_.keystate(UserInput::KeyCodeLetterDown) &&
|
!input_.keystate(UserInput::KeyCodeLetterDown) &&
|
||||||
!input_.keystate(UserInput::KeyCodeNextPlaylist))
|
!input_.keystate(UserInput::KeyCodeNextPlaylist) &&
|
||||||
|
!input_.keystate(UserInput::KeyCodeRandom))
|
||||||
{
|
{
|
||||||
keyLastTime_ = 0;
|
keyLastTime_ = 0;
|
||||||
keyDelayTime_= 0.3f;
|
keyDelayTime_= 0.3f;
|
||||||
@ -480,6 +481,10 @@ RetroFE::RETROFE_STATE RetroFE::processUserInput(Page *page)
|
|||||||
{
|
{
|
||||||
page->nextPlaylist();
|
page->nextPlaylist();
|
||||||
}
|
}
|
||||||
|
if(input_.keystate(UserInput::KeyCodeRandom))
|
||||||
|
{
|
||||||
|
page->selectRandom();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (input_.keystate(UserInput::KeyCodeAdminMode))
|
if (input_.keystate(UserInput::KeyCodeAdminMode))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user