From ff4b59730a667ac301bfd68adb4baf45fc5bac98 Mon Sep 17 00:00:00 2001 From: PhoenixR Date: Tue, 18 Mar 2025 09:21:48 +0000 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20src/MeloNX/MeloNX/App/View?= =?UTF-8?q?s/Main/ControllerView/ControllerView.swift?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Main/ControllerView/ControllerView.swift | 87 +++++++++++++++---- 1 file changed, 71 insertions(+), 16 deletions(-) diff --git a/src/MeloNX/MeloNX/App/Views/Main/ControllerView/ControllerView.swift b/src/MeloNX/MeloNX/App/Views/Main/ControllerView/ControllerView.swift index da922f31d..61f3085bd 100644 --- a/src/MeloNX/MeloNX/App/Views/Main/ControllerView/ControllerView.swift +++ b/src/MeloNX/MeloNX/App/Views/Main/ControllerView/ControllerView.swift @@ -30,7 +30,7 @@ struct ControllerView: View { VStack { ShoulderButtonsViewRight() ZStack { - Joystick(iscool: true) // hope this works + Joystick(iscool: true) // hope this works JoyStick ABXYView() } } @@ -47,7 +47,7 @@ struct ControllerView: View { } else { // could be landscape - VStack { + /*VStack { Spacer() VStack { @@ -57,8 +57,9 @@ struct ControllerView: View { VStack { ShoulderButtonsViewLeft() ZStack { - Joystick() - DPadView() + //Joystick() + Joystick4FTG() + //DPadView() Disable landscape Dpad } } HStack { @@ -77,7 +78,7 @@ struct ControllerView: View { VStack { ShoulderButtonsViewRight() ZStack { - Joystick(iscool: true) // hope this work s + //Joystick(iscool: true) // hope this work Disable right Joystick ABXYView() } } @@ -85,6 +86,35 @@ struct ControllerView: View { } // .padding(.bottom, geometry.size.height / 11) // also extremally broken ( + }*/ + + VStack { + Spacer() // 占据顶部空间 + HStack(alignment: .bottom) { + VStack(alignment: .leading) { + //ShoulderButtonsViewLeft() + Joystick4FTG() // 摇杆控件 + //.frame(maxWidth: .infinity, alignment: .leading) + } + .offset(x: 10, y: -5) // 向右移动(+) ,向上移动(﹣) + HStack { + VStack { + ButtonView(button: .back) // - 按钮 + } + Spacer() + VStack { + ButtonView(button: .start) // + 按钮 + } + } + + VStack { + ShoulderButtonsViewRight() + ZStack { + ABXYView() + } + }.offset(x: 30, y: 25) // 向右移动 50,向下移动 25 + } + .padding(.bottom, 10) // 适当增加 padding 让它靠近底部 } } } @@ -99,10 +129,11 @@ struct ShoulderButtonsViewLeft: View { var body: some View { HStack { - ButtonView(button: .leftTrigger) - .padding(.horizontal) - ButtonView(button: .leftShoulder) - .padding(.horizontal) + //move left Trigger + // ButtonView(button: .leftTrigger) + // .padding(.horizontal) + //ButtonView(button: .leftShoulder) + // .padding(.horizontal) } .frame(width: width, height: height) .onAppear() { @@ -118,8 +149,8 @@ struct ShoulderButtonsViewLeft: View { } struct ShoulderButtonsViewRight: View { - @State var width: CGFloat = 160 - @State var height: CGFloat = 20 + @State var width: CGFloat = 100 + @State var height: CGFloat = 60 @AppStorage("On-ScreenControllerScale") var controllerScale: Double = 1.0 var body: some View { @@ -128,6 +159,15 @@ struct ShoulderButtonsViewRight: View { .padding(.horizontal) ButtonView(button: .rightTrigger) .padding(.horizontal) + + } + HStack{ + //put left Trigger there + ButtonView(button: .leftTrigger) + .padding(.horizontal) + ButtonView(button: .leftShoulder) + .padding(.horizontal) + } .frame(width: width, height: height) .onAppear() { @@ -171,7 +211,7 @@ struct ABXYView: View { @State var size: CGFloat = 145 @AppStorage("On-ScreenControllerScale") var controllerScale: Double = 1.0 - var body: some View { + /*var body: some View { VStack { ButtonView(button: .X) HStack { @@ -182,6 +222,21 @@ struct ABXYView: View { ButtonView(button: .B) .padding(.horizontal) } + */ + //拳皇新布局 + var body: some View { + VStack(spacing: 5){ + HStack(spacing: 5) { + ButtonView(button: .Y) + ButtonView(button: .B) + + } + HStack(spacing: 5) { + ButtonView(button: .X) + ButtonView(button: .A) + + } + } .frame(width: size, height: size) .onAppear() { if UIDevice.current.systemName.contains("iPadOS") { @@ -195,8 +250,8 @@ struct ABXYView: View { struct ButtonView: View { var button: VirtualControllerButton - @State var width: CGFloat = 45 - @State var height: CGFloat = 45 + @State var width: CGFloat = 90 + @State var height: CGFloat = 90 @State var isPressed = false @AppStorage("onscreenhandheld") var onscreenjoy: Bool = false @Environment(\.colorScheme) var colorScheme @@ -210,14 +265,14 @@ struct ButtonView: View { .resizable() .frame(width: width, height: height) .foregroundColor(colorScheme == .dark ? Color.gray : Color.gray) - .opacity(isPressed ? 0.4 : 0.7) + .opacity(isPressed ? 0.3 : 0.6) .gesture( DragGesture(minimumDistance: 0) .onChanged { _ in if !self.isPressed { self.isPressed = true Ryujinx.shared.virtualController.setButtonState(1, for: button) - Haptics.shared.play(.heavy) + Haptics.shared.play(.light) } } .onEnded { _ in