diff options
| author | Kiloku <mateus.sateles@protonmail.com> | 2025-01-12 20:15:37 -0300 |
|---|---|---|
| committer | Lywx <kiritodev01@gmail.com> | 2025-01-12 20:00:48 -0600 |
| commit | 913fbfdd14ab296a469d2889a601b94fce51d2de (patch) | |
| tree | 79c744597b59168cb47958c72de53ae9c5bcaf7b /src/port/ui/ImguiUI.cpp | |
| parent | 2d538fac86336d5c9d5cc4628f8e6a00583c2c09 (diff) | |
Allow customizing HUD aspect ratio independently from game aspect ratio
Diffstat (limited to 'src/port/ui/ImguiUI.cpp')
| -rw-r--r-- | src/port/ui/ImguiUI.cpp | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/port/ui/ImguiUI.cpp b/src/port/ui/ImguiUI.cpp index d77e40d4..b5e256dc 100644 --- a/src/port/ui/ImguiUI.cpp +++ b/src/port/ui/ImguiUI.cpp @@ -440,6 +440,10 @@ void DrawGameMenu() { } } +static const char* hudAspects[] = { + "Native", "Custom", "Original (4:3)", "Widescreen (16:9)", "Nintendo 3DS (5:3)", "16:10 (8:5)", "Ultrawide (21:9)" +}; + void DrawEnhancementsMenu() { if (UIWidgets::BeginMenu("Enhancements")) { @@ -484,6 +488,59 @@ void DrawEnhancementsMenu() { ImGui::EndMenu(); } + if (UIWidgets::BeginMenu("HUD")) { + if (UIWidgets::CVarCombobox("HUD Aspect Ratio", "gHUDAspectRatio.Selection", hudAspects, + { + .tooltip = "Which Aspect Ratio to use when drawing the HUD (Radar, gauges and radio messages)", + .defaultIndex = 0, + })) { + CVarSetInteger("gHUDAspectRatio.Enabled", 1); + switch (CVarGetInteger("gHUDAspectRatio.Selection", 0)) { + case 0: + CVarSetInteger("gHUDAspectRatio.Enabled", 0); + CVarSetInteger("gHUDAspectRatio.X", 0); + CVarSetInteger("gHUDAspectRatio.Y", 0); + break; + case 1: + if (CVarGetInteger("gHUDAspectRatio.X", 0) <= 0){ + CVarSetInteger("gHUDAspectRatio.X", 1); + } + if (CVarGetInteger("gHUDAspectRatio.Y", 0) <= 0){ + CVarSetInteger("gHUDAspectRatio.Y", 1); + } + break; + case 2: + CVarSetInteger("gHUDAspectRatio.X", 4); + CVarSetInteger("gHUDAspectRatio.Y", 3); + break; + case 3: + CVarSetInteger("gHUDAspectRatio.X", 16); + CVarSetInteger("gHUDAspectRatio.Y", 9); + break; + case 4: + CVarSetInteger("gHUDAspectRatio.X", 5); + CVarSetInteger("gHUDAspectRatio.Y", 3); + break; + case 5: + CVarSetInteger("gHUDAspectRatio.X", 8); + CVarSetInteger("gHUDAspectRatio.Y", 5); + break; + case 6: + CVarSetInteger("gHUDAspectRatio.X", 21); + CVarSetInteger("gHUDAspectRatio.Y", 9); + break; + } + } + + if (CVarGetInteger("gHUDAspectRatio.Selection", 0) == 1) + { + UIWidgets::CVarSliderInt("Horizontal: %d", "gHUDAspectRatio.X", 1, 100, 1); + UIWidgets::CVarSliderInt("Vertical: %d", "gHUDAspectRatio.Y", 1, 100, 1); + } + + ImGui::EndMenu(); + } + ImGui::EndMenu(); } } |
