[imgui] Clean implementation of rounded edges

This commit is contained in:
Xphalnos 2024-11-01 16:09:27 +01:00 committed by Radosław Gliński
parent 464e9a1645
commit fbad66e5bc
3 changed files with 5 additions and 11 deletions

View File

@ -322,7 +322,6 @@ void EmulatorWindow::DisplayConfigDialog::OnDraw(ImGuiIO& io) {
// In the top-left corner so it's close to the menu bar from where it was // In the top-left corner so it's close to the menu bar from where it was
// opened. // opened.
// Origin Y coordinate 20 was taken from the Dear ImGui demo. // Origin Y coordinate 20 was taken from the Dear ImGui demo.
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 6.0f);
ImGui::SetNextWindowPos(ImVec2(20, 20), ImGuiCond_FirstUseEver); ImGui::SetNextWindowPos(ImVec2(20, 20), ImGuiCond_FirstUseEver);
ImGui::SetNextWindowSize(ImVec2(20, 20), ImGuiCond_FirstUseEver); ImGui::SetNextWindowSize(ImVec2(20, 20), ImGuiCond_FirstUseEver);
// Alpha from Dear ImGui tooltips (0.35 from the overlay provides too low // Alpha from Dear ImGui tooltips (0.35 from the overlay provides too low
@ -338,7 +337,6 @@ void EmulatorWindow::DisplayConfigDialog::OnDraw(ImGuiIO& io) {
return; return;
} }
ImGui::PopStyleVar();
// Even if the close button has been pressed, still paint everything not to // Even if the close button has been pressed, still paint everything not to
// have one frame with an empty window. // have one frame with an empty window.

View File

@ -97,7 +97,6 @@ void NoProfileDialog::OnDraw(ImGuiIO& io) {
const auto window_position = const auto window_position =
ImVec2(GetIO().DisplaySize.x * 0.35f, GetIO().DisplaySize.y * 0.4f); ImVec2(GetIO().DisplaySize.x * 0.35f, GetIO().DisplaySize.y * 0.4f);
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 6.0f);
ImGui::SetNextWindowPos(window_position, ImGuiCond_FirstUseEver); ImGui::SetNextWindowPos(window_position, ImGuiCond_FirstUseEver);
ImGui::SetNextWindowBgAlpha(1.0f); ImGui::SetNextWindowBgAlpha(1.0f);
@ -111,8 +110,6 @@ void NoProfileDialog::OnDraw(ImGuiIO& io) {
return; return;
} }
ImGui::PopStyleVar();
const std::string message = const std::string message =
"There is no profile available! You will not be able to save without " "There is no profile available! You will not be able to save without "
"one.\n\nWould you like to create one?"; "one.\n\nWould you like to create one?";
@ -169,7 +166,6 @@ void ProfileConfigDialog::OnDraw(ImGuiIO& io) {
auto profiles = profile_manager->GetProfiles(); auto profiles = profile_manager->GetProfiles();
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 6.0f);
ImGui::SetNextWindowPos(ImVec2(40, 40), ImGuiCond_FirstUseEver); ImGui::SetNextWindowPos(ImVec2(40, 40), ImGuiCond_FirstUseEver);
ImGui::SetNextWindowBgAlpha(0.8f); ImGui::SetNextWindowBgAlpha(0.8f);
@ -182,8 +178,6 @@ void ProfileConfigDialog::OnDraw(ImGuiIO& io) {
return; return;
} }
ImGui::PopStyleVar();
if (profiles->empty()) { if (profiles->empty()) {
ImGui::TextUnformatted("No profiles found!"); ImGui::TextUnformatted("No profiles found!");
ImGui::Spacing(); ImGui::Spacing();

View File

@ -142,9 +142,11 @@ void ImGuiDrawer::Initialize() {
InitializeFonts(); InitializeFonts();
auto& style = ImGui::GetStyle(); auto& style = ImGui::GetStyle();
style.ScrollbarRounding = 0; style.ScrollbarRounding = 6.0f;
style.WindowRounding = 0; style.WindowRounding = 6.0f;
style.TabRounding = 0; style.PopupRounding = 6.0f;
style.TabRounding = 6.0f;
style.Colors[ImGuiCol_Text] = ImVec4(0.89f, 0.90f, 0.90f, 1.00f); style.Colors[ImGuiCol_Text] = ImVec4(0.89f, 0.90f, 0.90f, 1.00f);
style.Colors[ImGuiCol_TextDisabled] = ImVec4(0.60f, 0.60f, 0.60f, 1.00f); style.Colors[ImGuiCol_TextDisabled] = ImVec4(0.60f, 0.60f, 0.60f, 1.00f);
style.Colors[ImGuiCol_WindowBg] = ImVec4(0.00f, 0.06f, 0.00f, 1.00f); style.Colors[ImGuiCol_WindowBg] = ImVec4(0.00f, 0.06f, 0.00f, 1.00f);