diff --git a/es-app/src/guis/GuiMenu.cpp b/es-app/src/guis/GuiMenu.cpp index 4fc85dd41..6319081a3 100644 --- a/es-app/src/guis/GuiMenu.cpp +++ b/es-app/src/guis/GuiMenu.cpp @@ -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>( + 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(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() diff --git a/es-core/src/Settings.cpp b/es-core/src/Settings.cpp index 8b980ba71..a5e5ee7b3 100644 --- a/es-core/src/Settings.cpp +++ b/es-core/src/Settings.cpp @@ -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