Add key to randomly highlight a game

This commit is contained in:
Don Honerbrink 2015-08-06 16:19:13 -05:00
parent e438ccfc2e
commit bf1286653a
8 changed files with 24 additions and 1 deletions

View File

@ -7,6 +7,7 @@ pageDown = B
letterUp = N
letterDown = M
nextPlaylist = P
random = R
select = Space
back = Escape
quit = Q

View File

@ -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;

View File

@ -40,6 +40,7 @@ public:
KeyCodeLetterDown,
KeyCodeLetterUp,
KeyCodeNextPlaylist,
KeyCodeRandom,
KeyCodeAdminMode,
KeyCodeHideItem,
KeyCodeQuit,

View File

@ -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()
{

View File

@ -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);

View File

@ -407,6 +407,11 @@ void Page::pageScroll(ScrollDirection direction)
}
}
void Page::selectRandom()
{
if(activeMenu_) activeMenu_->random();
}
void Page::letterScroll(ScrollDirection direction)
{
if(activeMenu_)

View File

@ -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();

View File

@ -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))