-
Notifications
You must be signed in to change notification settings - Fork 517
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] Add missing API for XCode15. Fixes #15725 #19708
Open
mandel-macaque
wants to merge
9
commits into
xamarin:main
Choose a base branch
from
mandel-macaque:net8.0-xcode15-gamecontroller
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 8 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
e6f1f88
[GameController] Add missing API for XCode15. Fixes #15725
mandel-macaque 1514090
Merge branch 'main' into net8.0-xcode15-gamecontroller
mandel-macaque 4c73e06
Missing ','
mandel-macaque 087db04
Auto-format source code
f2d784c
Apply suggestions from code review
mandel-macaque 7457c41
Merge branch 'main' into net8.0-xcode15-gamecontroller
mandel-macaque b7ad3ac
Fix code after taking contributions in the PR review.
mandel-macaque b44cdc7
Merge branch 'main' into net8.0-xcode15-gamecontroller
mandel-macaque f26a018
Merge branch 'main' into net8.0-xcode15-gamecontroller
mandel-macaque File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#if !WATCH | ||
|
||
using Foundation; | ||
using ObjCRuntime; | ||
using System; | ||
using System.Runtime.InteropServices; | ||
|
||
#nullable enable | ||
|
||
namespace GameController { | ||
|
||
public class GCButtonElementName { | ||
|
||
#if NET | ||
[SupportedOSPlatform ("ios16.0")] | ||
[SupportedOSPlatform ("maccatalyst16.0")] | ||
[SupportedOSPlatform ("tvos16.0")] | ||
[SupportedOSPlatform ("macos14.0")] | ||
#else | ||
[TV (16, 0), Mac (13, 0), iOS (16, 0), MacCatalyst (16, 0)] | ||
#endif | ||
[DllImport (Constants.GameControllerLibrary)] | ||
static extern /* GCButtonElementName */ IntPtr GCInputArcadeButtonName (nint row, nint column); | ||
|
||
#if NET | ||
[SupportedOSPlatform ("ios16.0")] | ||
[SupportedOSPlatform ("maccatalyst16.0")] | ||
[SupportedOSPlatform ("tvos16.0")] | ||
[SupportedOSPlatform ("macos14.0")] | ||
#else | ||
[TV (16, 0), Mac (13, 0), iOS (16, 0), MacCatalyst (16, 0)] | ||
#endif | ||
public static NSString? GetArcadeButtonName (nint row, nint column) | ||
=> Runtime.GetNSObject<NSString> (GCInputArcadeButtonName (row, column)); | ||
|
||
} | ||
|
||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using System; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using System.Runtime.Versioning; | ||
using ObjCRuntime; | ||
using Foundation; | ||
|
||
#if !NET | ||
using NativeHandle = System.IntPtr; | ||
#endif | ||
|
||
#nullable enable | ||
|
||
namespace GameController { | ||
|
||
#if NET | ||
[SupportedOSPlatform ("ios16.0")] | ||
[SupportedOSPlatform ("maccatalyst16.0")] | ||
[SupportedOSPlatform ("macos13.0")] | ||
[SupportedOSPlatform ("tvos16.0")] | ||
#else | ||
[TV (16, 0), Mac (13, 0), iOS (16, 0), MacCatalyst (16, 0)] | ||
#endif | ||
[Register ("GCPhysicalInputElementCollection", SkipRegistration = true)] | ||
public sealed partial class GCPhysicalInputElementCollection<TKey, TValue> : GCPhysicalInputElementCollection | ||
where TKey : NSString | ||
where TValue : class, IGCPhysicalInputElement { | ||
|
||
public GCPhysicalInputElementCollection (NSObjectFlag coder) | ||
: base (coder) | ||
{ | ||
} | ||
|
||
public TValue? GetElement (TKey alias) | ||
=> Runtime.GetINativeObject<TValue> (_ObjectForKeyedSubscript (alias), false); | ||
|
||
public TValue? GetObject (TKey keyedSubscript) | ||
=> Runtime.GetINativeObject<TValue> (_ObjectForKeyedSubscript (keyedSubscript), false); | ||
|
||
public NSEnumerator<IGCPhysicalInputElement> ElementEnumerator | ||
=> Runtime.GetNSObject<NSEnumerator<IGCPhysicalInputElement>> (_ElementEnumerator)!; | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be a property, not a field.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a property, notice the '=>' and not a '='
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah - this is exactly why Sebastien said to not use => for properties, it's a very small difference from fields (just a single character), and can end up confusing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's also
public
and notprivate
which is the better indicator for me personally.