gamepad live feedback overlay

This commit is contained in:
True Zhuanjia committed 2026-04-06 01:19:44 +08:00
1 parent 7f4108c4e3
commit 5af39e8fb6
19 files changed
+1583 -382

No files matched your search

File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -5,7 +5,7 @@ import SwiftUI
struct VoidLinkSwiftUIApp: App {
var body: some Scene {
WindowGroup {
WidgetPickerView()
AbstractGamepadView()
}
}
}
+12 -10
View File
@@ -414,6 +414,16 @@ struct WidgetPickerView: View {
allowsShortcutCombo: false,
forcedComboMode: nil
),
FunctionalButtonOption(
label: SwiftLocalizationHelper.localizedString(forKey: "🎮 overlay switch"),
cmd: "GAMEPADOVERLAY",
tip: SwiftLocalizationHelper.localizedString(forKey: "Switch on/off a floating gamepad overlay with live input feedback"),
allowsKeyboardCombination: false,
allowsGamepadCombination: false,
allowsSkillCombo: false,
allowsShortcutCombo: false,
forcedComboMode: nil
),
FunctionalButtonOption(
label: SwiftLocalizationHelper.localizedString(forKey: "Pressure curve"),
cmd: "PRESSURECURVE",
@@ -654,6 +664,7 @@ struct WidgetPickerView: View {
case .gamepad:
AbstractGamepadView(
gamepadType: selectedGamepadType,
metricsProfile: .picker,
canSelectCommand: { canSelectCommand($0, source: .gamepad) },
isCommandSelected: { selectedCmds.contains($0) },
onCommandSelected: { appendCommand($0, source: .gamepad) },
@@ -1841,13 +1852,10 @@ struct WidgetPickerView: View {
if gamepadCommands.contains(cmd) {
return .gamepad
}
if keyboardCommands.contains(cmd) {
return .keyboard
}
if functionalCommands.contains(cmd) {
return .functional
}
return nil
return .keyboard
}
private func canonicalCommand(for cmd: String) -> String {
@@ -1877,12 +1885,6 @@ struct WidgetPickerView: View {
]
}
private var keyboardCommands: Set<String> {
Set(CommandManager.keyboardButtonMappings.keys)
.union(Set(CommandManager.mouseButtonMappings.keys))
.union(keyboardPadCommands)
}
private var functionalCommands: Set<String> {
Set(functionalButtonOptions.map(\.cmd)).union(gyroCommands)
}