From 32402490b64aeb5e04f118ff68f4c22d2d17efb4 Mon Sep 17 00:00:00 2001 From: TJ Lambert <50846373+tj-devel709@users.noreply.github.com> Date: Mon, 28 Jun 2021 10:37:42 -0500 Subject: [PATCH] [GameController] Updates for Xcode13 beta1 (#12014) * Initial changes for xcode13 GameController beta1 * syntax and name change * name change and adding async Co-authored-by: tj_devel709 --- src/gamecontroller.cs | 123 +++++++++++++++++- .../MacCatalyst-GameController.todo | 34 ----- tests/xtro-sharpie/iOS-GameController.todo | 34 ----- tests/xtro-sharpie/macOS-GameController.todo | 18 --- tests/xtro-sharpie/tvOS-GameController.todo | 18 --- 5 files changed, 122 insertions(+), 105 deletions(-) delete mode 100644 tests/xtro-sharpie/MacCatalyst-GameController.todo delete mode 100644 tests/xtro-sharpie/iOS-GameController.todo delete mode 100644 tests/xtro-sharpie/macOS-GameController.todo delete mode 100644 tests/xtro-sharpie/tvOS-GameController.todo diff --git a/src/gamecontroller.cs b/src/gamecontroller.cs index 4d3c8a8975cb..d590f760c19b 100644 --- a/src/gamecontroller.cs +++ b/src/gamecontroller.cs @@ -3,7 +3,7 @@ // // Authors: // Aaron Bockover (abock@xamarin.com) -// TJ Lambert (t-anlamb@microsoft.com) +// TJ Lambert (antlambe@microsoft.com) // Whitney Schmidt (whschm@microsoft.com) // // Copyright 2013, 2015 Xamarin Inc. @@ -19,9 +19,11 @@ using AppKit; using UIViewController = AppKit.NSViewController; using CHHapticEngine = Foundation.NSObject; +using BezierPath = AppKit.NSBezierPath; #else using CoreHaptics; using UIKit; +using BezierPath = UIKit.UIBezierPath; #endif namespace GameController { @@ -963,6 +965,14 @@ interface GCPhysicalInputProfile [Export ("setStateFromPhysicalInput:")] void SetState (GCPhysicalInputProfile physicalInput); + + [TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)] + [Export ("allTouchpads", ArgumentSemantic.Strong)] + NSSet AllTouchpads { get; } + + [TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)] + [Export ("touchpads", ArgumentSemantic.Strong)] + NSDictionary Touchpads { get; } } [TV (14, 0), Mac (11, 0), iOS (14, 0)] @@ -1267,6 +1277,38 @@ partial interface GCKey [Field ("GCKeyF12")] NSString F12 { get; } + [TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)] + [Field ("GCKeyF13")] + NSString F13 { get; } + + [TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)] + [Field ("GCKeyF14")] + NSString F14 { get; } + + [TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)] + [Field ("GCKeyF15")] + NSString F15 { get; } + + [TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)] + [Field ("GCKeyF16")] + NSString F16 { get; } + + [TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)] + [Field ("GCKeyF17")] + NSString F17 { get; } + + [TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)] + [Field ("GCKeyF18")] + NSString F18 { get; } + + [TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)] + [Field ("GCKeyF19")] + NSString F19 { get; } + + [TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)] + [Field ("GCKeyF20")] + NSString F20 { get; } + [Field ("GCKeyPrintScreen")] NSString PrintScreen { get; } @@ -1651,6 +1693,38 @@ interface GCKeyCode [Field ("GCKeyCodeF12")] nint F12 { get; } + [TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)] + [Field ("GCKeyCodeF13")] + nint F13 { get; } + + [TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)] + [Field ("GCKeyCodeF14")] + nint F14 { get; } + + [TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)] + [Field ("GCKeyCodeF15")] + nint F15 { get; } + + [TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)] + [Field ("GCKeyCodeF16")] + nint F16 { get; } + + [TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)] + [Field ("GCKeyCodeF17")] + nint F17 { get; } + + [TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)] + [Field ("GCKeyCodeF18")] + nint F18 { get; } + + [TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)] + [Field ("GCKeyCodeF19")] + nint F19 { get; } + + [TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)] + [Field ("GCKeyCodeF20")] + nint F20 { get; } + [Field ("GCKeyCodePrintScreen")] nint PrintScreen { get; } @@ -1922,4 +1996,51 @@ enum GCInputDirectional { [Field ("GCInputDirectionalCardinalDpad")] CardinalDpad, } + + delegate GCVirtualControllerElementConfiguration GCVirtualControllerElementUpdateBlock (GCVirtualControllerElementConfiguration configuration); + + [NoTV, NoMac, NoWatch, iOS (15,0), MacCatalyst (15,0)] + [BaseType (typeof (NSObject))] + [DisableDefaultCtor] + interface GCVirtualController + { + [Static] + [Export ("virtualControllerWithConfiguration:")] + GCVirtualController Create (GCVirtualControllerConfiguration configuration); + + [Async] + [Export ("connectWithReply:")] + void Connect ([NullAllowed] Action reply); + + [Export ("disconnect")] + void Disconnect (); + + [NullAllowed, Export ("controller", ArgumentSemantic.Weak)] + GCController Controller { get; } + + [Export ("changeElement:configuration:")] + void Change (string element, GCVirtualControllerElementUpdateBlock configuration); + } + + [NoTV, NoMac, NoWatch, iOS (15,0), MacCatalyst (15,0)] + [BaseType (typeof (NSObject))] + interface GCVirtualControllerConfiguration + { + [Export ("elements", ArgumentSemantic.Strong)] + NSSet Elements { get; set; } + } + + [NoTV, NoMac, NoWatch, iOS (15,0), MacCatalyst (15,0)] + [BaseType (typeof (NSObject))] + interface GCVirtualControllerElementConfiguration + { + [Export ("hidden")] + bool Hidden { get; set; } + + [NullAllowed, Export ("path", ArgumentSemantic.Strong)] + BezierPath Path { get; set; } + + [Export ("touchpad")] + bool Touchpad { get; set; } + } } diff --git a/tests/xtro-sharpie/MacCatalyst-GameController.todo b/tests/xtro-sharpie/MacCatalyst-GameController.todo deleted file mode 100644 index 11cff8a58c44..000000000000 --- a/tests/xtro-sharpie/MacCatalyst-GameController.todo +++ /dev/null @@ -1,34 +0,0 @@ -!missing-field! GCKeyCodeF13 not bound -!missing-field! GCKeyCodeF14 not bound -!missing-field! GCKeyCodeF15 not bound -!missing-field! GCKeyCodeF16 not bound -!missing-field! GCKeyCodeF17 not bound -!missing-field! GCKeyCodeF18 not bound -!missing-field! GCKeyCodeF19 not bound -!missing-field! GCKeyCodeF20 not bound -!missing-field! GCKeyF13 not bound -!missing-field! GCKeyF14 not bound -!missing-field! GCKeyF15 not bound -!missing-field! GCKeyF16 not bound -!missing-field! GCKeyF17 not bound -!missing-field! GCKeyF18 not bound -!missing-field! GCKeyF19 not bound -!missing-field! GCKeyF20 not bound -!missing-selector! +GCVirtualController::virtualControllerWithConfiguration: not bound -!missing-selector! GCPhysicalInputProfile::allTouchpads not bound -!missing-selector! GCPhysicalInputProfile::touchpads not bound -!missing-selector! GCVirtualController::changeElement:configuration: not bound -!missing-selector! GCVirtualController::connectWithReply: not bound -!missing-selector! GCVirtualController::controller not bound -!missing-selector! GCVirtualController::disconnect not bound -!missing-selector! GCVirtualControllerConfiguration::elements not bound -!missing-selector! GCVirtualControllerConfiguration::setElements: not bound -!missing-selector! GCVirtualControllerElementConfiguration::hidden not bound -!missing-selector! GCVirtualControllerElementConfiguration::path not bound -!missing-selector! GCVirtualControllerElementConfiguration::setHidden: not bound -!missing-selector! GCVirtualControllerElementConfiguration::setPath: not bound -!missing-selector! GCVirtualControllerElementConfiguration::setTouchpad: not bound -!missing-selector! GCVirtualControllerElementConfiguration::touchpad not bound -!missing-type! GCVirtualController not bound -!missing-type! GCVirtualControllerConfiguration not bound -!missing-type! GCVirtualControllerElementConfiguration not bound diff --git a/tests/xtro-sharpie/iOS-GameController.todo b/tests/xtro-sharpie/iOS-GameController.todo deleted file mode 100644 index 11cff8a58c44..000000000000 --- a/tests/xtro-sharpie/iOS-GameController.todo +++ /dev/null @@ -1,34 +0,0 @@ -!missing-field! GCKeyCodeF13 not bound -!missing-field! GCKeyCodeF14 not bound -!missing-field! GCKeyCodeF15 not bound -!missing-field! GCKeyCodeF16 not bound -!missing-field! GCKeyCodeF17 not bound -!missing-field! GCKeyCodeF18 not bound -!missing-field! GCKeyCodeF19 not bound -!missing-field! GCKeyCodeF20 not bound -!missing-field! GCKeyF13 not bound -!missing-field! GCKeyF14 not bound -!missing-field! GCKeyF15 not bound -!missing-field! GCKeyF16 not bound -!missing-field! GCKeyF17 not bound -!missing-field! GCKeyF18 not bound -!missing-field! GCKeyF19 not bound -!missing-field! GCKeyF20 not bound -!missing-selector! +GCVirtualController::virtualControllerWithConfiguration: not bound -!missing-selector! GCPhysicalInputProfile::allTouchpads not bound -!missing-selector! GCPhysicalInputProfile::touchpads not bound -!missing-selector! GCVirtualController::changeElement:configuration: not bound -!missing-selector! GCVirtualController::connectWithReply: not bound -!missing-selector! GCVirtualController::controller not bound -!missing-selector! GCVirtualController::disconnect not bound -!missing-selector! GCVirtualControllerConfiguration::elements not bound -!missing-selector! GCVirtualControllerConfiguration::setElements: not bound -!missing-selector! GCVirtualControllerElementConfiguration::hidden not bound -!missing-selector! GCVirtualControllerElementConfiguration::path not bound -!missing-selector! GCVirtualControllerElementConfiguration::setHidden: not bound -!missing-selector! GCVirtualControllerElementConfiguration::setPath: not bound -!missing-selector! GCVirtualControllerElementConfiguration::setTouchpad: not bound -!missing-selector! GCVirtualControllerElementConfiguration::touchpad not bound -!missing-type! GCVirtualController not bound -!missing-type! GCVirtualControllerConfiguration not bound -!missing-type! GCVirtualControllerElementConfiguration not bound diff --git a/tests/xtro-sharpie/macOS-GameController.todo b/tests/xtro-sharpie/macOS-GameController.todo deleted file mode 100644 index 8f7dd95403ce..000000000000 --- a/tests/xtro-sharpie/macOS-GameController.todo +++ /dev/null @@ -1,18 +0,0 @@ -!missing-field! GCKeyCodeF13 not bound -!missing-field! GCKeyCodeF14 not bound -!missing-field! GCKeyCodeF15 not bound -!missing-field! GCKeyCodeF16 not bound -!missing-field! GCKeyCodeF17 not bound -!missing-field! GCKeyCodeF18 not bound -!missing-field! GCKeyCodeF19 not bound -!missing-field! GCKeyCodeF20 not bound -!missing-field! GCKeyF13 not bound -!missing-field! GCKeyF14 not bound -!missing-field! GCKeyF15 not bound -!missing-field! GCKeyF16 not bound -!missing-field! GCKeyF17 not bound -!missing-field! GCKeyF18 not bound -!missing-field! GCKeyF19 not bound -!missing-field! GCKeyF20 not bound -!missing-selector! GCPhysicalInputProfile::allTouchpads not bound -!missing-selector! GCPhysicalInputProfile::touchpads not bound diff --git a/tests/xtro-sharpie/tvOS-GameController.todo b/tests/xtro-sharpie/tvOS-GameController.todo deleted file mode 100644 index 8f7dd95403ce..000000000000 --- a/tests/xtro-sharpie/tvOS-GameController.todo +++ /dev/null @@ -1,18 +0,0 @@ -!missing-field! GCKeyCodeF13 not bound -!missing-field! GCKeyCodeF14 not bound -!missing-field! GCKeyCodeF15 not bound -!missing-field! GCKeyCodeF16 not bound -!missing-field! GCKeyCodeF17 not bound -!missing-field! GCKeyCodeF18 not bound -!missing-field! GCKeyCodeF19 not bound -!missing-field! GCKeyCodeF20 not bound -!missing-field! GCKeyF13 not bound -!missing-field! GCKeyF14 not bound -!missing-field! GCKeyF15 not bound -!missing-field! GCKeyF16 not bound -!missing-field! GCKeyF17 not bound -!missing-field! GCKeyF18 not bound -!missing-field! GCKeyF19 not bound -!missing-field! GCKeyF20 not bound -!missing-selector! GCPhysicalInputProfile::allTouchpads not bound -!missing-selector! GCPhysicalInputProfile::touchpads not bound