Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GameController] Updates for Xcode13 beta1 #12014

Merged
merged 3 commits into from
Jun 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
123 changes: 122 additions & 1 deletion src/gamecontroller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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 {
Expand Down Expand Up @@ -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<GCControllerTouchpad> AllTouchpads { get; }

[TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
[Export ("touchpads", ArgumentSemantic.Strong)]
NSDictionary<NSString, GCControllerTouchpad> Touchpads { get; }
}

[TV (14, 0), Mac (11, 0), iOS (14, 0)]
Expand Down Expand Up @@ -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; }

Expand Down Expand Up @@ -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; }

Expand Down Expand Up @@ -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]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rolfbjarne I know you already reviewed this PR but I just wanted to make sure that this line is correct. Also for others reviewing later:
I added this since there didn't appear to be an initializer for this interface and we have the virtualControllerWithConfiguration: that creates an instance

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this looks entirely correct!

Also, if in doubt, it's better to put this attribute than to not to, because we can always add the default ctor later (but we can't remove it once we've made it a part of the stable API).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay thank you!

interface GCVirtualController
{
[Static]
[Export ("virtualControllerWithConfiguration:")]
GCVirtualController Create (GCVirtualControllerConfiguration configuration);

[Async]
[Export ("connectWithReply:")]
void Connect ([NullAllowed] Action<NSError> reply);
tj-devel709 marked this conversation as resolved.
Show resolved Hide resolved

[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<NSString> 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; }
}
}
34 changes: 0 additions & 34 deletions tests/xtro-sharpie/MacCatalyst-GameController.todo

This file was deleted.

34 changes: 0 additions & 34 deletions tests/xtro-sharpie/iOS-GameController.todo

This file was deleted.

18 changes: 0 additions & 18 deletions tests/xtro-sharpie/macOS-GameController.todo

This file was deleted.

18 changes: 0 additions & 18 deletions tests/xtro-sharpie/tvOS-GameController.todo

This file was deleted.