From a8994d8b50d5949825907f5f31c44263569ae87c Mon Sep 17 00:00:00 2001 From: Daniil Vinogradov Date: Mon, 14 Jul 2025 22:19:13 +0200 Subject: [PATCH] Aspect Ratio selection menu added --- .../EmulationView/EmulationView.swift | 27 +++++++++---------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/src/MeloNX/MeloNX/App/Views/Main/Emulation/EmulationView/EmulationView.swift b/src/MeloNX/MeloNX/App/Views/Main/Emulation/EmulationView/EmulationView.swift index 718af4e3d..30fb19ce6 100644 --- a/src/MeloNX/MeloNX/App/Views/Main/Emulation/EmulationView/EmulationView.swift +++ b/src/MeloNX/MeloNX/App/Views/Main/Emulation/EmulationView/EmulationView.swift @@ -80,10 +80,18 @@ struct EmulationView: View { Image(systemName: pauseEmu ? "pause.circle" : "play.circle") } } - - Button { - // ryujijnx.config?.aspectRatio - ryujijnx.aspectRatio = nextAspectRatio(current: ryujijnx.aspectRatio) + Menu() { + ForEach(AspectRatio.allCases.filter { $0 != ryujijnx.aspectRatio }, id: \.self) { ratio in + Button { + ryujijnx.aspectRatio = ratio + } label: { + Label { + Text(ratio.displayName) + } icon: { + Image(systemName: "rectangle.expand.vertical") + } + } + } } label: { Label { Text(ryujijnx.aspectRatio.displayName) @@ -178,17 +186,6 @@ struct EmulationView: View { // } } } - - func nextAspectRatio(current: AspectRatio) -> AspectRatio { - let all = AspectRatio.allCases - if let index = all.firstIndex(of: current) { - let nextIndex = (index + 1) % all.count - return all[nextIndex] - } else { - return .fixed16x9 // Default fallback - } - } - } // This is just to stop the sound on macOS when doing a keypress