mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-25 15:45:38 +00:00
(Android) Added an option for controlling the touch overlay opacity
Also added an 'extra small' overlay size entry
This commit is contained in:
parent
1cd3138fc5
commit
a1a104e003
|
@ -1156,6 +1156,7 @@ void GuiMenu::openInputDeviceOptions()
|
|||
touchOverlaySize->add("MEDIUM", "medium", selectedOverlaySize == "medium");
|
||||
touchOverlaySize->add("LARGE", "large", selectedOverlaySize == "large");
|
||||
touchOverlaySize->add("SMALL", "small", selectedOverlaySize == "small");
|
||||
touchOverlaySize->add("EXTRA SMALL", "x-small", selectedOverlaySize == "x-small");
|
||||
// If there are no objects returned, then there must be a manually modified entry in the
|
||||
// configuration file. Simply set the overlay size to "medium" in this case.
|
||||
if (touchOverlaySize->getSelectedObjects().size() == 0)
|
||||
|
@ -1171,6 +1172,29 @@ void GuiMenu::openInputDeviceOptions()
|
|||
}
|
||||
});
|
||||
|
||||
// Touch overlay opacity.
|
||||
auto touchOverlayOpacity = std::make_shared<OptionListComponent<std::string>>(
|
||||
getHelpStyle(), "TOUCH OVERLAY OPACITY", false);
|
||||
std::string selectedOverlayOpacity {
|
||||
Settings::getInstance()->getString("InputTouchOverlayOpacity")};
|
||||
touchOverlayOpacity->add("NORMAL", "normal", selectedOverlayOpacity == "normal");
|
||||
touchOverlayOpacity->add("LOW", "low", selectedOverlayOpacity == "low");
|
||||
touchOverlayOpacity->add("VERY LOW", "verylow", selectedOverlayOpacity == "verylow");
|
||||
// If there are no objects returned, then there must be a manually modified entry in the
|
||||
// configuration file. Simply set the overlay opacity to "normal" in this case.
|
||||
if (touchOverlayOpacity->getSelectedObjects().size() == 0)
|
||||
touchOverlayOpacity->selectEntry(0);
|
||||
s->addWithLabel("TOUCH OVERLAY OPACITY", touchOverlayOpacity);
|
||||
s->addSaveFunc([touchOverlayOpacity, s] {
|
||||
if (touchOverlayOpacity->getSelected() !=
|
||||
Settings::getInstance()->getString("InputTouchOverlayOpacity")) {
|
||||
Settings::getInstance()->setString("InputTouchOverlayOpacity",
|
||||
touchOverlayOpacity->getSelected());
|
||||
s->setNeedsSaving();
|
||||
InputOverlay::getInstance().createButtons();
|
||||
}
|
||||
});
|
||||
|
||||
// Touch overlay fade-out timer.
|
||||
auto touchOverlayFadeTime = std::make_shared<SliderComponent>(0.0f, 20.0f, 1.0f, "s");
|
||||
touchOverlayFadeTime->setValue(
|
||||
|
@ -1209,6 +1233,12 @@ void GuiMenu::openInputDeviceOptions()
|
|||
->getChild(touchOverlaySize->getChildIndex() - 1)
|
||||
->setOpacity(DISABLED_OPACITY);
|
||||
|
||||
touchOverlayOpacity->setEnabled(false);
|
||||
touchOverlayOpacity->setOpacity(DISABLED_OPACITY);
|
||||
touchOverlayOpacity->getParent()
|
||||
->getChild(touchOverlayOpacity->getChildIndex() - 1)
|
||||
->setOpacity(DISABLED_OPACITY);
|
||||
|
||||
touchOverlayFadeTime->setEnabled(false);
|
||||
touchOverlayFadeTime->setOpacity(DISABLED_OPACITY);
|
||||
touchOverlayFadeTime->getParent()
|
||||
|
@ -1217,7 +1247,7 @@ void GuiMenu::openInputDeviceOptions()
|
|||
}
|
||||
|
||||
auto inputTouchOverlayCallback = [this, inputTouchOverlay, touchOverlaySize,
|
||||
touchOverlayFadeTime]() {
|
||||
touchOverlayOpacity, touchOverlayFadeTime]() {
|
||||
if (!inputTouchOverlay->getState()) {
|
||||
const std::string message {
|
||||
"DON'T DISABLE THE TOUCH OVERLAY UNLESS YOU ARE USING A CONTROLLER OR YOU WILL "
|
||||
|
@ -1242,6 +1272,12 @@ void GuiMenu::openInputDeviceOptions()
|
|||
->getChild(touchOverlaySize->getChildIndex() - 1)
|
||||
->setOpacity(DISABLED_OPACITY);
|
||||
|
||||
touchOverlayOpacity->setEnabled(false);
|
||||
touchOverlayOpacity->setOpacity(DISABLED_OPACITY);
|
||||
touchOverlayOpacity->getParent()
|
||||
->getChild(touchOverlayOpacity->getChildIndex() - 1)
|
||||
->setOpacity(DISABLED_OPACITY);
|
||||
|
||||
touchOverlayFadeTime->setEnabled(false);
|
||||
touchOverlayFadeTime->setOpacity(DISABLED_OPACITY);
|
||||
touchOverlayFadeTime->getParent()
|
||||
|
@ -1255,6 +1291,12 @@ void GuiMenu::openInputDeviceOptions()
|
|||
->getChild(touchOverlaySize->getChildIndex() - 1)
|
||||
->setOpacity(1.0f);
|
||||
|
||||
touchOverlayOpacity->setEnabled(true);
|
||||
touchOverlayOpacity->setOpacity(1.0f);
|
||||
touchOverlayOpacity->getParent()
|
||||
->getChild(touchOverlayOpacity->getChildIndex() - 1)
|
||||
->setOpacity(1.0f);
|
||||
|
||||
touchOverlayFadeTime->setEnabled(true);
|
||||
touchOverlayFadeTime->setOpacity(1.0f);
|
||||
touchOverlayFadeTime->getParent()
|
||||
|
|
|
@ -241,6 +241,7 @@ void Settings::setDefaults()
|
|||
mStringMap["InputControllerType"] = {"xbox", "xbox"};
|
||||
#if defined(__ANDROID__)
|
||||
mStringMap["InputTouchOverlaySize"] = {"medium", "medium"};
|
||||
mStringMap["InputTouchOverlayOpacity"] = {"normal", "normal"};
|
||||
mIntMap["InputTouchOverlayFadeTime"] = {6, 6};
|
||||
mBoolMap["InputTouchOverlay"] = {true, true};
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue