The OptionListComponent key repeat parameters are now configurable.

This commit is contained in:
Leon Styhre 2021-10-08 21:11:38 +02:00
parent 67489b0500
commit 9c20498339
2 changed files with 11 additions and 3 deletions

View file

@ -101,7 +101,7 @@ GuiGamelistOptions::GuiGamelistOptions(Window* window, SystemData* system)
// Enable key repeat so that the left or right button can be held to cycle through
// the letters.
mJumpToLetterList->setKeyRepeat(true);
mJumpToLetterList->setKeyRepeat(true, 650, 200);
// Populate the quick selector.
for (unsigned int i = 0; i < mFirstLetterIndex.size(); i++) {
@ -139,7 +139,7 @@ GuiGamelistOptions::GuiGamelistOptions(Window* window, SystemData* system)
// Enable key repeat so that the left or right button can be held to cycle through
// the sort options.
mListSort->setKeyRepeat(true);
mListSort->setKeyRepeat(true, 650, 400);
// Don't show the sort type option if the gamelist type is recent/last played.
if (system->getName() != "recent")

View file

@ -247,7 +247,15 @@ public:
}
void setOverrideMultiText(const std::string& text) { mOverrideMultiText = text; }
void setKeyRepeat(bool state) { mKeyRepeat = state; }
void setKeyRepeat(bool state,
int delay = OPTIONLIST_REPEAT_START_DELAY,
int speed = OPTIONLIST_REPEAT_SPEED)
{
mKeyRepeat = state;
mKeyRepeatStartDelay = delay;
mKeyRepeatSpeed = speed;
}
void update(int deltaTime) override
{