[GameController] Add Support for DotNet Attributes (#12554)

Co-authored-by: tj_devel709 <antlambe@microsoft.com>
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
This commit is contained in:
TJ Lambert 2021-08-27 11:18:49 -05:00 коммит произвёл GitHub
Родитель 03c9c7c379
Коммит dc4db0c2ae
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
5 изменённых файлов: 257 добавлений и 2 удалений

Просмотреть файл

@ -11,11 +11,25 @@ using System;
using ObjCRuntime;
using Foundation;
using System.Runtime.Versioning;
namespace GameController {
#if !NET
[Deprecated (PlatformName.MacOSX, 10, 15, message: "Use 'GCController.GetMicroGamepadController()' instead.")]
[Deprecated (PlatformName.iOS, 13, 0, message: "Use 'GCController.GetMicroGamepadController()' instead.")]
[Deprecated (PlatformName.TvOS, 13, 0, message: "Use 'GCController.GetMicroGamepadController()' instead.")]
#else
[UnsupportedOSPlatform ("ios13.0")]
[UnsupportedOSPlatform ("tvos13.0")]
[UnsupportedOSPlatform ("macos10.15")]
#if IOS
[Obsolete ("Starting with ios13.0 use 'GCController.GetMicroGamepadController()' instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
#elif TVOS
[Obsolete ("Starting with tvos13.0 use 'GCController.GetMicroGamepadController()' instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
#elif MONOMAC
[Obsolete ("Starting with macos10.15 use 'GCController.GetMicroGamepadController()' instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
#endif
#endif
[Native]
public enum GCExtendedGamepadSnapshotDataVersion : long
{
@ -29,7 +43,13 @@ namespace GameController {
Version1 = 0x0100,
}
#if !NET
[TV (14,0), Mac (11,0), iOS (14,0)]
#else
[SupportedOSPlatform ("ios14.0")]
[SupportedOSPlatform ("tvos14.0")]
[SupportedOSPlatform ("macos11.0")]
#endif
[Native]
public enum GCTouchState : long
{
@ -38,7 +58,13 @@ namespace GameController {
Moving,
}
#if !NET
[TV (14,0), Mac (11,0), iOS (14,0)]
#else
[SupportedOSPlatform ("ios14.0")]
[SupportedOSPlatform ("tvos14.0")]
[SupportedOSPlatform ("macos11.0")]
#endif
[Native]
public enum GCDeviceBatteryState : long
{
@ -48,7 +74,13 @@ namespace GameController {
Full,
}
#if !NET
[TV (14,0), Mac (11,0), iOS (14,0)]
#else
[SupportedOSPlatform ("ios14.0")]
[SupportedOSPlatform ("tvos14.0")]
[SupportedOSPlatform ("macos11.0")]
#endif
[Native]
public enum GCSystemGestureState : long
{
@ -57,7 +89,9 @@ namespace GameController {
Disabled,
}
#if !NET
[iOS (9,0)][Mac (10,11)]
#endif
[Native]
public enum GCControllerPlayerIndex : long {
Unset = -1,

Просмотреть файл

@ -10,6 +10,7 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using ObjCRuntime;
using Foundation;
@ -18,11 +19,25 @@ namespace GameController {
// GCExtendedGamepadSnapshot.h
// float_t are 4 bytes (at least for ARM64)
[StructLayout (LayoutKind.Sequential, Pack = 1)]
#if !NET
[iOS (7,0)]
[Mac (10,9)]
[Deprecated (PlatformName.iOS, 12, 2, message: "Use 'GCExtendedGamepadSnapshotData' instead.")]
[Deprecated (PlatformName.MacOSX, 10, 14, 4, message: "Use 'GCExtendedGamepadSnapshotData' instead.")]
[Deprecated (PlatformName.TvOS, 12, 2, message: "Use 'GCExtendedGamepadSnapshotData' instead.")]
#else
[UnsupportedOSPlatform ("ios12.2")]
[UnsupportedOSPlatform ("tvos12.2")]
[UnsupportedOSPlatform ("macos10.14.4")]
#if IOS
[Obsolete ("Starting with ios12.2 use 'GCExtendedGamepadSnapshotData' instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
#elif TVOS
[Obsolete ("Starting with tvos12.2 use 'GCExtendedGamepadSnapshotData' instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
#elif MONOMAC
[Obsolete ("Starting with macos10.14.4 use 'GCExtendedGamepadSnapshotData' instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
#endif
#endif
public struct GCExtendedGamepadSnapShotDataV100 {
// Standard information
@ -58,9 +73,22 @@ namespace GameController {
// [TV (12, 1), Mac (10, 14, 1), iOS (12, 1)]
// public bool RightThumbstickButton;
#if !NET
[Deprecated (PlatformName.MacOSX, 10, 15, message: "Use 'GCController.GetExtendedGamepadController()' instead.")]
[Deprecated (PlatformName.iOS, 13, 0, message: "Use 'GCController.GetExtendedGamepadController()' instead.")]
[Deprecated (PlatformName.TvOS, 13, 0, message: "Use 'GCController.GetExtendedGamepadController()' instead.")]
#else
[UnsupportedOSPlatform ("ios13.0")]
[UnsupportedOSPlatform ("tvos13.0")]
[UnsupportedOSPlatform ("macos10.15")]
#if IOS
[Obsolete ("Starting with ios13.0 use 'GCController.GetExtendedGamepadController()' instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
#elif TVOS
[Obsolete ("Starting with tvos13.0 use 'GCController.GetExtendedGamepadController()' instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
#elif MONOMAC
[Obsolete ("Starting with macos10.15 use 'GCController.GetExtendedGamepadController()' instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
#endif
#endif
[DllImport (Constants.GameControllerLibrary)]
static extern /* NSData * __nullable */ IntPtr NSDataFromGCExtendedGamepadSnapShotDataV100 (
/* GCExtendedGamepadSnapShotDataV100 * __nullable */ ref GCExtendedGamepadSnapShotDataV100 snapshotData);
@ -72,9 +100,22 @@ namespace GameController {
}
}
#if !NET
[Deprecated (PlatformName.MacOSX, 10, 15, message: "Use 'GCController.GetExtendedGamepadController()' instead.")]
[Deprecated (PlatformName.iOS, 13, 0, message: "Use 'GCController.GetExtendedGamepadController()' instead.")]
[Deprecated (PlatformName.TvOS, 13, 0, message: "Use 'GCController.GetExtendedGamepadController()' instead.")]
#else
[UnsupportedOSPlatform ("ios13.0")]
[UnsupportedOSPlatform ("tvos13.0")]
[UnsupportedOSPlatform ("macos10.15")]
#if IOS
[Obsolete ("Starting with ios13.0 use 'GCController.GetExtendedGamepadController()' instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
#elif TVOS
[Obsolete ("Starting with tvos13.0 use 'GCController.GetExtendedGamepadController()' instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
#elif MONOMAC
[Obsolete ("Starting with macos10.15 use 'GCController.GetExtendedGamepadController()' instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
#endif
#endif
// float_t are 4 bytes (at least for ARM64)
[StructLayout (LayoutKind.Sequential, Pack = 1)]
public struct GCExtendedGamepadSnapshotData {
@ -106,21 +147,51 @@ namespace GameController {
public float /* float_t = float */ LeftTrigger;
public float /* float_t = float */ RightTrigger;
#if !NET
[iOS (12, 2), Mac (10, 14, 4), TV (12, 2)]
#else
[SupportedOSPlatform ("ios12.2")]
[SupportedOSPlatform ("tvos12.2")]
[SupportedOSPlatform ("macos10.14.4")]
#endif
public bool SupportsClickableThumbsticks;
#if !NET
[TV (12, 2), Mac (10, 14, 4), iOS (12, 2)]
#else
[SupportedOSPlatform ("ios12.2")]
[SupportedOSPlatform ("tvos12.2")]
[SupportedOSPlatform ("macos10.14.4")]
#endif
bool LeftThumbstickButton;
#if !NET
[TV (12, 2), Mac (10, 14, 4), iOS (12, 2)]
#else
[SupportedOSPlatform ("ios12.2")]
[SupportedOSPlatform ("tvos12.2")]
[SupportedOSPlatform ("macos10.14.4")]
#endif
bool RightThumbstickButton;
[DllImport (Constants.GameControllerLibrary)]
#if !NET
[TV (12, 2), Mac (10, 14, 4), iOS (12, 2)]
#else
[SupportedOSPlatform ("ios12.2")]
[SupportedOSPlatform ("tvos12.2")]
[SupportedOSPlatform ("macos10.14.4")]
#endif
static extern /* NSData * __nullable */ IntPtr NSDataFromGCExtendedGamepadSnapshotData (
/* GCExtendedGamepadSnapshotData * __nullable */ ref GCExtendedGamepadSnapshotData snapshotData);
#if !NET
[TV (12, 2), Mac (10, 14, 4), iOS (12, 2)]
#else
[SupportedOSPlatform ("ios12.2")]
[SupportedOSPlatform ("tvos12.2")]
[SupportedOSPlatform ("macos10.14.4")]
#endif
public NSData ToNSData ()
{
var p = NSDataFromGCExtendedGamepadSnapshotData (ref this);
@ -139,7 +210,14 @@ namespace GameController {
[DllImport (Constants.GameControllerLibrary)]
[return: MarshalAs (UnmanagedType.I1)]
#if !NET
[TV (12, 2), Mac (10, 14, 4), iOS (12, 2)]
#else
[SupportedOSPlatform ("ios12.2")]
[SupportedOSPlatform ("tvos12.2")]
[SupportedOSPlatform ("macos10.14.4")]
#endif
static extern bool GCExtendedGamepadSnapshotDataFromNSData (
/* GCExtendedGamepadSnapshotData * __nullable */ out GCExtendedGamepadSnapshotData snapshotData,
/* NSData * __nullable */ IntPtr data);
@ -149,7 +227,13 @@ namespace GameController {
return GCExtendedGamepadSnapShotDataV100FromNSData (out snapshotData, data == null ? IntPtr.Zero : data.Handle);
}
#if !NET
[TV (12, 2), Mac (10, 14, 4), iOS (12, 2)]
#else
[SupportedOSPlatform ("ios12.2")]
[SupportedOSPlatform ("tvos12.2")]
[SupportedOSPlatform ("macos10.14.4")]
#endif
public static bool TryGetExtendedSnapShotData (NSData data, out GCExtendedGamepadSnapshotData snapshotData)
{
return GCExtendedGamepadSnapshotDataFromNSData (out snapshotData, data == null ? IntPtr.Zero : data.Handle);

Просмотреть файл

@ -8,6 +8,7 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using ObjCRuntime;
using Foundation;
@ -15,12 +16,25 @@ using Foundation;
namespace GameController {
// GCGamepadSnapshot.h
// float_t are 4 bytes (at least for ARM64)
#if !NET
[Deprecated (PlatformName.MacOSX, 10, 15, message: "Use 'GCExtendedGamepad' instead.")]
[Deprecated (PlatformName.iOS, 13, 0, message: "Use 'GCExtendedGamepad' instead.")]
[Deprecated (PlatformName.TvOS, 13, 0, message: "Use 'GCExtendedGamepad' instead.")]
[StructLayout (LayoutKind.Sequential, Pack = 1)]
[iOS (7,0)]
[Mac (10,9)]
#else
[UnsupportedOSPlatform ("ios13.0")]
[UnsupportedOSPlatform ("tvos13.0")]
[UnsupportedOSPlatform ("macos10.15")]
#if IOS
[Obsolete ("Starting with ios13.0 Use 'GCExtendedGamepad' instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
#elif TVOS
[Obsolete ("Starting with tvos13.0 Use 'GCExtendedGamepad' instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
#elif MONOMAC
[Obsolete ("Starting with macos10.15 Use 'GCExtendedGamepad' instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
#endif
#endif
[StructLayout (LayoutKind.Sequential, Pack = 1)]
public struct GCGamepadSnapShotDataV100 {
// Standard information

Просмотреть файл

@ -4,6 +4,7 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using ObjCRuntime;
using Foundation;
@ -16,9 +17,22 @@ namespace GameController {
// GCMicroGamepadSnapshot.h
// float_t are 4 bytes (at least for ARM64)
[StructLayout (LayoutKind.Sequential, Pack = 1)]
#if !NET
[Deprecated (PlatformName.iOS, 12, 2, message: "Use 'GCController.GetMicroGamepadController()' instead.")]
[Deprecated (PlatformName.MacOSX, 10, 14, 4, message: "Use 'GCController.GetMicroGamepadController()' instead.")]
[Deprecated (PlatformName.TvOS, 12, 2, message: "Use 'GCController.GetMicroGamepadController()' instead.")]
#else
[UnsupportedOSPlatform ("ios12.2")]
[UnsupportedOSPlatform ("tvos12.2")]
[UnsupportedOSPlatform ("macos10.14.4")]
#if IOS
[Obsolete ("Starting with ios12.2 use 'GCController.GetMicroGamepadController()' instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
#elif TVOS
[Obsolete ("Starting with tvos12.2 use 'GCController.GetMicroGamepadController()' instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
#elif MONOMAC
[Obsolete ("Starting with macos10.14.4 use 'GCController.GetMicroGamepadController()' instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
#endif
#endif
public struct GCMicroGamepadSnapShotDataV100 {
// Standard information
@ -34,9 +48,22 @@ namespace GameController {
public float /* float_t = float */ ButtonA;
public float /* float_t = float */ ButtonX;
#if !NET
[Deprecated (PlatformName.MacOSX, 10, 15, message: "Use 'GCController.GetMicroGamepadController()' instead.")]
[Deprecated (PlatformName.iOS, 13, 0, message: "Use 'GCController.GetMicroGamepadController()' instead.")]
[Deprecated (PlatformName.TvOS, 13, 0, message: "Use 'GCController.GetMicroGamepadController()' instead.")]
#else
[UnsupportedOSPlatform ("ios13.0")]
[UnsupportedOSPlatform ("tvos13.0")]
[UnsupportedOSPlatform ("macos10.15")]
#if IOS
[Obsolete ("Starting with ios13.0 use 'GCController.GetMicroGamepadController()' instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
#elif TVOS
[Obsolete ("Starting with tvos13.0 use 'GCController.GetMicroGamepadController()' instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
#elif MONOMAC
[Obsolete ("Starting with macos10.15 use 'GCController.GetMicroGamepadController()' instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
#endif
#endif
[DllImport (Constants.GameControllerLibrary)]
static extern /* NSData * __nullable */ IntPtr NSDataFromGCMicroGamepadSnapShotDataV100 (
/* __nullable */ ref GCMicroGamepadSnapShotDataV100 snapshotData);
@ -50,9 +77,22 @@ namespace GameController {
// GCMicroGamepadSnapshot.h
// float_t are 4 bytes (at least for ARM64)
#if !NET
[Deprecated (PlatformName.MacOSX, 10, 15, message: "Use 'GCController.GetMicroGamepadController()' instead.")]
[Deprecated (PlatformName.iOS, 13, 0, message: "Use 'GCController.GetMicroGamepadController()' instead.")]
[Deprecated (PlatformName.TvOS, 13, 0, message: "Use 'GCController.GetMicroGamepadController()' instead.")]
#else
[UnsupportedOSPlatform ("ios13.0")]
[UnsupportedOSPlatform ("tvos13.0")]
[UnsupportedOSPlatform ("macos10.15")]
#if IOS
[Obsolete ("Starting with ios13.0 use 'GCController.GetMicroGamepadController()' instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
#elif TVOS
[Obsolete ("Starting with tvos13.0 use 'GCController.GetMicroGamepadController()' instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
#elif MONOMAC
[Obsolete ("Starting with macos10.15 use 'GCController.GetMicroGamepadController()' instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
#endif
#endif
[StructLayout (LayoutKind.Sequential, Pack = 1)]
public struct GCMicroGamepadSnapshotData {
@ -70,11 +110,23 @@ namespace GameController {
public float /* float_t = float */ ButtonX;
[DllImport (Constants.GameControllerLibrary)]
#if !NET
[TV (12, 2), Mac (10, 14, 4), iOS (12, 2)]
#else
[SupportedOSPlatform ("ios12.2")]
[SupportedOSPlatform ("tvos12.2")]
[SupportedOSPlatform ("macos10.14.4")]
#endif
static extern /* NSData * __nullable */ IntPtr NSDataFromGCMicroGamepadSnapshotData (
/* __nullable */ ref GCMicroGamepadSnapshotData snapshotData);
#if !NET
[TV (12, 2), Mac (10, 14, 4), iOS (12, 2)]
#else
[SupportedOSPlatform ("ios12.2")]
[SupportedOSPlatform ("tvos12.2")]
[SupportedOSPlatform ("macos10.14.4")]
#endif
public NSData ToNSData ()
{
var p = NSDataFromGCMicroGamepadSnapshotData (ref this);
@ -86,30 +138,83 @@ namespace GameController {
public partial class GCMicroGamepadSnapshot {
// GCGamepadSnapshot.h
#if !NET
[Deprecated (PlatformName.MacOSX, 10, 15, message: "Use 'GCController.GetMicroGamepadController()' instead.")]
[Deprecated (PlatformName.iOS, 13, 0, message: "Use 'GCController.GetMicroGamepadController()' instead.")]
[Deprecated (PlatformName.TvOS, 13, 0, message: "Use 'GCController.GetMicroGamepadController()' instead.")]
#else
// Already provided by partial class in gamecontroller.cs
// [UnsupportedOSPlatform ("ios13.0")]
// [UnsupportedOSPlatform ("tvos13.0")]
// [UnsupportedOSPlatform ("macos10.15")]
#if IOS
[Obsolete ("Starting with ios13.0 use 'GCController.GetMicroGamepadController()' instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
#elif TVOS
[Obsolete ("Starting with tvos13.0 use 'GCController.GetMicroGamepadController()' instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
#elif MONOMAC
[Obsolete ("Starting with macos10.15 use 'GCController.GetMicroGamepadController()' instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
#endif
#endif
[DllImport (Constants.GameControllerLibrary)]
[return: MarshalAs (UnmanagedType.I1)]
static extern bool GCMicroGamepadSnapShotDataV100FromNSData (out GCMicroGamepadSnapShotDataV100 snapshotData, /* NSData */ IntPtr data);
#if !NET
[Deprecated (PlatformName.iOS, 12, 2, message: "Use 'TryGetSnapshotData (NSData, out GCMicroGamepadSnapshotData)' instead.")]
[Deprecated (PlatformName.MacOSX, 10, 14, 4, message: "Use 'TryGetSnapshotData (NSData, out GCMicroGamepadSnapshotData)' instead.")]
[Deprecated (PlatformName.TvOS, 12, 2, message: "Use 'TryGetSnapshotData (NSData, out GCMicroGamepadSnapshotData)' instead.")]
#else
[UnsupportedOSPlatform ("ios12.2")]
[UnsupportedOSPlatform ("tvos12.2")]
[UnsupportedOSPlatform ("macos10.14.4")]
#if IOS
[Obsolete ("Starting with ios12.2 use 'TryGetSnapshotData (NSData, out GCMicroGamepadSnapshotData)' instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
#elif TVOS
[Obsolete ("Starting with tvos12.2 use 'TryGetSnapshotData (NSData, out GCMicroGamepadSnapshotData)' instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
#elif MONOMAC
[Obsolete ("Starting with macos10.14.4 use 'TryGetSnapshotData (NSData, out GCMicroGamepadSnapshotData)' instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
#endif
#endif
public static bool TryGetSnapshotData (NSData data, out GCMicroGamepadSnapShotDataV100 snapshotData)
{
return GCMicroGamepadSnapShotDataV100FromNSData (out snapshotData, data == null ? IntPtr.Zero : data.Handle);
}
#if !NET
[Deprecated (PlatformName.MacOSX, 10, 15, message: "Use 'GCController.GetMicroGamepadController()' instead.")]
[Deprecated (PlatformName.iOS, 13, 0, message: "Use 'GCController.GetMicroGamepadController()' instead.")]
[Deprecated (PlatformName.TvOS, 13, 0, message: "Use 'GCController.GetMicroGamepadController()' instead.")]
#else
// Already provided by partial class in gamecontroller.cs
// [UnsupportedOSPlatform ("ios13.0")]
// [UnsupportedOSPlatform ("tvos13.0")]
// [UnsupportedOSPlatform ("macos10.15")]
#if IOS
[Obsolete ("Starting with ios13.0 use 'GCController.GetMicroGamepadController()' instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
#elif TVOS
[Obsolete ("Starting with tvos13.0 use 'GCController.GetMicroGamepadController()' instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
#elif MONOMAC
[Obsolete ("Starting with macos10.15 use 'GCController.GetMicroGamepadController()' instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
#endif
#endif
[DllImport (Constants.GameControllerLibrary)]
[return: MarshalAs (UnmanagedType.I1)]
#if !NET
[TV (12, 2), Mac (10, 14, 4), iOS (12, 2)]
#else
[SupportedOSPlatform ("ios12.2")]
[SupportedOSPlatform ("tvos12.2")]
[SupportedOSPlatform ("macos10.14.4")]
#endif
static extern bool GCMicroGamepadSnapshotDataFromNSData (out GCMicroGamepadSnapshotData snapshotData, /* NSData */ IntPtr data);
#if !NET
[TV (12, 2), Mac (10, 14, 4), iOS (12, 2)]
#else
[SupportedOSPlatform ("ios12.2")]
[SupportedOSPlatform ("tvos12.2")]
[SupportedOSPlatform ("macos10.14.4")]
#endif
public static bool TryGetSnapshotData (NSData data, out GCMicroGamepadSnapshotData snapshotData)
{
return GCMicroGamepadSnapshotDataFromNSData (out snapshotData, data == null ? IntPtr.Zero : data.Handle);

Просмотреть файл

@ -7,33 +7,51 @@
// Copyright 2019 Microsoft Corporation.
using System;
using System.Runtime.Versioning;
using ObjCRuntime;
using Foundation;
namespace GameController {
#if !NET
[Introduced (PlatformName.iOS, 13, 0)]
[Introduced (PlatformName.MacOSX, 10, 15)]
[Introduced (PlatformName.TvOS, 13, 0)]
#else
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos10.15")]
#endif
public struct GCAcceleration {
public double X;
public double Y;
public double Z;
}
#if !NET
[Introduced (PlatformName.iOS, 13, 0)]
[Introduced (PlatformName.MacOSX, 10, 15)]
[Introduced (PlatformName.TvOS, 13, 0)]
#else
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos10.15")]
#endif
public struct GCRotationRate {
public double X;
public double Y;
public double Z;
}
#if !NET
[Introduced (PlatformName.iOS, 13, 0)]
[Introduced (PlatformName.MacOSX, 10, 15)]
[Introduced (PlatformName.TvOS, 13, 0)]
#else
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos10.15")]
#endif
public struct GCQuaternion {
public double X;
public double Y;