diff --git a/core/rend/gui.cpp b/core/rend/gui.cpp index 641a106c6..63b1a36d8 100644 --- a/core/rend/gui.cpp +++ b/core/rend/gui.cpp @@ -650,7 +650,7 @@ static void gui_display_commands() ImGui::Columns(1, nullptr, false); // Exit - if (ImGui::Button("Exit", ScaledVec2(300, 50) + if (ImGui::Button(commandLineStart ? "Exit" : "Close Game", ScaledVec2(300, 50) + ImVec2(ImGui::GetStyle().ColumnsMinSpacing + ImGui::GetStyle().FramePadding.x * 2 - 1, 0))) { gui_stop_game(); @@ -2166,7 +2166,7 @@ static void gui_display_settings() ShowHelpMarker("Internal render resolution. Higher is better, but more demanding on the GPU. Values higher than your display resolution (but no more than double your display resolution) can be used for supersampling, which provides high-quality antialiasing without reducing sharpness."); OptionSlider("Horizontal Stretching", config::ScreenStretching, 100, 250, - "Stretch the screen horizontally"); + "Stretch the screen horizontally", "%d%%"); OptionArrowButtons("Frame Skipping", config::SkipFrame, 0, 6, "Number of frames to skip between two actually rendered frames"); } @@ -2232,7 +2232,7 @@ static void gui_display_settings() { #ifdef _OPENMP OptionArrowButtons("Texture Upscaling", config::TextureUpscale, 1, 8, - "Upscale textures with the xBRZ algorithm. Only on fast platforms and for certain 2D games"); + "Upscale textures with the xBRZ algorithm. Only on fast platforms and for certain 2D games", "x%d"); OptionSlider("Texture Max Size", config::MaxFilteredTextureSize, 8, 1024, "Textures larger than this dimension squared will not be upscaled"); OptionArrowButtons("Max Threads", config::MaxThreads, 1, 8, @@ -2295,7 +2295,7 @@ static void gui_display_settings() "Enable the Dreamcast Digital Sound Processor. Only recommended on fast platforms"); OptionCheckbox("Enable VMU Sounds", config::VmuSound, "Play VMU beeps when enabled."); - if (OptionSlider("Volume Level", config::AudioVolume, 0, 100, "Adjust the emulator's audio level")) + if (OptionSlider("Volume Level", config::AudioVolume, 0, 100, "Adjust the emulator's audio level", "%d%%")) { config::AudioVolume.calcDbPower(); }; diff --git a/core/rend/gui_util.cpp b/core/rend/gui_util.cpp index 3b7b44638..c836f7b9e 100644 --- a/core/rend/gui_util.cpp +++ b/core/rend/gui_util.cpp @@ -517,7 +517,7 @@ bool OptionSlider(const char *name, config::Option& option, template bool OptionSlider(const char *name, config::Option& option, int min, int max, const char *help, const char *format); template bool OptionSlider(const char *name, config::Option& option, int min, int max, const char *help, const char *format); -bool OptionArrowButtons(const char *name, config::Option& option, int min, int max, const char *help) +bool OptionArrowButtons(const char *name, config::Option& option, int min, int max, const char *help, const char *format) { const float innerSpacing = ImGui::GetStyle().ItemInnerSpacing.x; ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(0.f, 0.5f)); // Left @@ -526,7 +526,15 @@ bool OptionArrowButtons(const char *name, config::Option& option, int min, std::string id = "##" + std::string(name); ImGui::PushStyleVar(ImGuiStyleVar_DisabledAlpha, 1.0f); ImGui::BeginDisabled(); - ImGui::ButtonEx((std::to_string((int)option) + id).c_str(), ImVec2(width, 0)); + int size = snprintf(nullptr, 0, format, (int)option); + std::string value; + if (size >= 0) + { + value.resize(size + 1); + snprintf(value.data(), size + 1, format, (int)option); + value.resize(size); + } + ImGui::ButtonEx((value + id).c_str(), ImVec2(width, 0)); ImGui::EndDisabled(); ImGui::PopStyleVar(); ImGui::PopStyleColor(); diff --git a/core/rend/gui_util.h b/core/rend/gui_util.h index d6098f48f..931c07bd9 100644 --- a/core/rend/gui_util.h +++ b/core/rend/gui_util.h @@ -50,7 +50,7 @@ template bool OptionRadioButton(const char *name, config::Option& option, T value, const char *help = nullptr); void OptionComboBox(const char *name, config::Option& option, const char *values[], int count, const char *help = nullptr); -bool OptionArrowButtons(const char *name, config::Option& option, int min, int max, const char *help = nullptr); +bool OptionArrowButtons(const char *name, config::Option& option, int min, int max, const char *help = nullptr, const char *format = "%d"); static inline void centerNextWindow() {