InputManager: replace pageUp/Down with left/rightShoulder and create an alias (via isMappedLike) to accomodate existing configs that use the PageUp/Down buttons.

This commit is contained in:
Cristi Mitrana 2019-12-23 16:12:35 +02:00
parent ef186e7bd6
commit 3b85735a2d
6 changed files with 15 additions and 11 deletions

View file

@ -269,20 +269,20 @@ bool TextListComponent<T>::input(InputConfig* config, Input input)
listInput(-1); listInput(-1);
return true; return true;
} }
if(config->isMappedTo("pagedown", input)) if(config->isMappedLike("rightshoulder", input))
{ {
listInput(10); listInput(10);
return true; return true;
} }
if(config->isMappedTo("pageup", input)) if(config->isMappedLike("leftshoulder", input))
{ {
listInput(-10); listInput(-10);
return true; return true;
} }
}else{ }else{
if(config->isMappedLike("down", input) || config->isMappedLike("up", input) || if(config->isMappedLike("down", input) || config->isMappedLike("up", input) ||
config->isMappedTo("pagedown", input) || config->isMappedTo("pageup", input)) config->isMappedLike("rightshoulder", input) || config->isMappedTo("leftshoulder", input))
{ {
stopScrolling(); stopScrolling();
} }

View file

@ -94,12 +94,12 @@ void GridGameListView::setCursor(FileData* file)
std::string GridGameListView::getQuickSystemSelectRightButton() std::string GridGameListView::getQuickSystemSelectRightButton()
{ {
return "pagedown"; //rightshoulder return "rightshoulder";
} }
std::string GridGameListView::getQuickSystemSelectLeftButton() std::string GridGameListView::getQuickSystemSelectLeftButton()
{ {
return "pageup"; //leftshoulder return "leftshoulder";
} }
bool GridGameListView::input(InputConfig* config, Input input) bool GridGameListView::input(InputConfig* config, Input input)

View file

@ -122,6 +122,10 @@ bool InputConfig::isMappedLike(const std::string& name, Input input)
return isMappedTo("up", input) || isMappedTo("leftanalogup", input) || isMappedTo("rightanalogup", input); return isMappedTo("up", input) || isMappedTo("leftanalogup", input) || isMappedTo("rightanalogup", input);
}else if(name == "down"){ }else if(name == "down"){
return isMappedTo("down", input) || isMappedTo("leftanalogdown", input) || isMappedTo("rightanalogdown", input); return isMappedTo("down", input) || isMappedTo("leftanalogdown", input) || isMappedTo("rightanalogdown", input);
}else if(name == "leftshoulder"){
return isMappedTo("leftshoulder", input) || isMappedTo("pageup", input);
}else if(name == "rightshoulder"){
return isMappedTo("rightshoulder", input) || isMappedTo("pagedown", input);
} }
return isMappedTo(name, input); return isMappedTo(name, input);
} }

View file

@ -328,8 +328,8 @@ void InputManager::loadDefaultKBConfig()
cfg->mapInput("start", Input(DEVICE_KEYBOARD, TYPE_KEY, SDLK_F1, 1, true)); cfg->mapInput("start", Input(DEVICE_KEYBOARD, TYPE_KEY, SDLK_F1, 1, true));
cfg->mapInput("select", Input(DEVICE_KEYBOARD, TYPE_KEY, SDLK_F2, 1, true)); cfg->mapInput("select", Input(DEVICE_KEYBOARD, TYPE_KEY, SDLK_F2, 1, true));
cfg->mapInput("pageup", Input(DEVICE_KEYBOARD, TYPE_KEY, SDLK_RIGHTBRACKET, 1, true)); cfg->mapInput("leftshoulder", Input(DEVICE_KEYBOARD, TYPE_KEY, SDLK_LEFTBRACKET, 1, true));
cfg->mapInput("pagedown", Input(DEVICE_KEYBOARD, TYPE_KEY, SDLK_LEFTBRACKET, 1, true)); cfg->mapInput("rightshoulder", Input(DEVICE_KEYBOARD, TYPE_KEY, SDLK_RIGHTBRACKET, 1, true));
} }
void InputManager::writeDeviceConfig(InputConfig* config) void InputManager::writeDeviceConfig(InputConfig* config)

View file

@ -80,10 +80,10 @@ bool ComponentList::input(InputConfig* config, Input input)
{ {
return listInput(input.value != 0 ? 1 : 0); return listInput(input.value != 0 ? 1 : 0);
}else if(config->isMappedTo("pageup", input)) }else if(config->isMappedLike("leftshoulder", input))
{ {
return listInput(input.value != 0 ? -6 : 0); return listInput(input.value != 0 ? -6 : 0);
}else if(config->isMappedTo("pagedown", input)){ }else if(config->isMappedLike("rightshoulder", input)){
return listInput(input.value != 0 ? 6 : 0); return listInput(input.value != 0 ? 6 : 0);
} }

View file

@ -53,9 +53,9 @@ bool DateTimeEditComponent::input(InputConfig* config, Input input)
} }
int incDir = 0; int incDir = 0;
if(config->isMappedLike("up", input) || config->isMappedTo("pageup", input)) if(config->isMappedLike("up", input) || config->isMappedLike("leftshoulder", input))
incDir = 1; incDir = 1;
else if(config->isMappedLike("down", input) || config->isMappedTo("pagedown", input)) else if(config->isMappedLike("down", input) || config->isMappedLike("rightshoulder", input))
incDir = -1; incDir = -1;
if(incDir != 0) if(incDir != 0)