[gameplaykit] Add bindings from Xcode 9.0 (#2798)
Re-based from Miguel's PR #2476 including reviewers feedback. [1] https://github.com/xamarin/xamarin-macios/pull/2476 * [spritekit] Add GKSceneRootNodeType to SKScene too and adjust intro tests * [tests][intro][macos] Don't skip protocol checks for SceneKit on 64 bits
This commit is contained in:
Родитель
f2f99e945f
Коммит
6aead42617
|
@ -12,6 +12,7 @@ using System.ComponentModel;
|
||||||
using XamCore.ObjCRuntime;
|
using XamCore.ObjCRuntime;
|
||||||
using XamCore.Foundation;
|
using XamCore.Foundation;
|
||||||
using XamCore.SpriteKit;
|
using XamCore.SpriteKit;
|
||||||
|
using XamCore.SceneKit;
|
||||||
using Vector2 = global::OpenTK.Vector2;
|
using Vector2 = global::OpenTK.Vector2;
|
||||||
using Vector2d = global::OpenTK.Vector2d;
|
using Vector2d = global::OpenTK.Vector2d;
|
||||||
using Vector2i = global::OpenTK.Vector2i;
|
using Vector2i = global::OpenTK.Vector2i;
|
||||||
|
@ -361,6 +362,16 @@ namespace XamCore.GameplayKit {
|
||||||
[Export ("findActionForAnswers:")]
|
[Export ("findActionForAnswers:")]
|
||||||
[return: NullAllowed]
|
[return: NullAllowed]
|
||||||
NSObject FindAction (NSDictionary<NSObject, NSObject> answers);
|
NSObject FindAction (NSDictionary<NSObject, NSObject> answers);
|
||||||
|
|
||||||
|
[iOS (11,0), TV (11,0)]
|
||||||
|
[Mac (10,13, onlyOn64: true)]
|
||||||
|
[Export ("initWithURL:error:")]
|
||||||
|
IntPtr Constructor (NSUrl url, [NullAllowed] NSError error);
|
||||||
|
|
||||||
|
[iOS (11,0), TV (11,0)]
|
||||||
|
[Mac (10,13, onlyOn64: true)]
|
||||||
|
[Export ("exportToURL:error:")]
|
||||||
|
bool Export (NSUrl url, [NullAllowed] NSError error);
|
||||||
}
|
}
|
||||||
|
|
||||||
[iOS (9,0), Mac (10,11, onlyOn64 : true)]
|
[iOS (9,0), Mac (10,11, onlyOn64 : true)]
|
||||||
|
@ -1786,6 +1797,12 @@ namespace XamCore.GameplayKit {
|
||||||
[return: NullAllowed]
|
[return: NullAllowed]
|
||||||
GKScene FromFile (string filename);
|
GKScene FromFile (string filename);
|
||||||
|
|
||||||
|
[iOS (11,0)][TV (11,0)][Mac (10,13, onlyOn64: true)]
|
||||||
|
[Static]
|
||||||
|
[Export ("sceneWithFileNamed:rootNode:")]
|
||||||
|
[return: NullAllowed]
|
||||||
|
GKScene FromFile (string filename, IGKSceneRootNodeType rootNode);
|
||||||
|
|
||||||
[Export ("entities")]
|
[Export ("entities")]
|
||||||
GKEntity [] Entities { get; }
|
GKEntity [] Entities { get; }
|
||||||
|
|
||||||
|
@ -1808,6 +1825,23 @@ namespace XamCore.GameplayKit {
|
||||||
void RemoveGraph (string name);
|
void RemoveGraph (string name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[iOS (11,0)]
|
||||||
|
[TV (11,0)]
|
||||||
|
[Mac (10,13, onlyOn64: true)]
|
||||||
|
[BaseType (typeof(GKComponent))]
|
||||||
|
interface GKSCNNodeComponent : GKAgentDelegate
|
||||||
|
{
|
||||||
|
[Static]
|
||||||
|
[Export ("componentWithNode:")]
|
||||||
|
GKSCNNodeComponent FromNode (SCNNode node);
|
||||||
|
|
||||||
|
[Export ("initWithNode:")]
|
||||||
|
IntPtr Constructor (SCNNode node);
|
||||||
|
|
||||||
|
[Export ("node")]
|
||||||
|
SCNNode Node { get; }
|
||||||
|
}
|
||||||
|
|
||||||
[iOS (10,0), TV (10,0), Mac (10,12, onlyOn64: true)]
|
[iOS (10,0), TV (10,0), Mac (10,12, onlyOn64: true)]
|
||||||
[Category]
|
[Category]
|
||||||
[BaseType (typeof (SKNode))]
|
[BaseType (typeof (SKNode))]
|
||||||
|
@ -1833,6 +1867,17 @@ namespace XamCore.GameplayKit {
|
||||||
void SetEntity (GKEntity entity);
|
void SetEntity (GKEntity entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[iOS (11,0), TV (11,0), Mac (10,13, onlyOn64: true)]
|
||||||
|
[Category]
|
||||||
|
[BaseType (typeof (SCNNode))]
|
||||||
|
interface SCNNode_GameplayKit {
|
||||||
|
[Export ("entity")]
|
||||||
|
GKEntity GetEntity ();
|
||||||
|
|
||||||
|
[Export ("setEntity:")]
|
||||||
|
void SetEntity (GKEntity entity);
|
||||||
|
}
|
||||||
|
|
||||||
[iOS (10,0), TV (10,0), Mac (10,12, onlyOn64: true)]
|
[iOS (10,0), TV (10,0), Mac (10,12, onlyOn64: true)]
|
||||||
[BaseType (typeof (NSObject), Name = "GKQuadtreeNode")] // Renamed to GKQuadtreeNode (lower case t) in Xcode8
|
[BaseType (typeof (NSObject), Name = "GKQuadtreeNode")] // Renamed to GKQuadtreeNode (lower case t) in Xcode8
|
||||||
[DisableDefaultCtor] // <quote>Used as a hint for faster removal via [GKQuadTree removeData:WithNode:]</quote>
|
[DisableDefaultCtor] // <quote>Used as a hint for faster removal via [GKQuadTree removeData:WithNode:]</quote>
|
||||||
|
|
|
@ -45,6 +45,7 @@ using XamCore.SpriteKit;
|
||||||
#if (XAMCORE_2_0 || !MONOMAC) && !WATCH
|
#if (XAMCORE_2_0 || !MONOMAC) && !WATCH
|
||||||
using XamCore.ModelIO;
|
using XamCore.ModelIO;
|
||||||
using XamCore.Metal;
|
using XamCore.Metal;
|
||||||
|
using XamCore.GameplayKit;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if MONOMAC
|
#if MONOMAC
|
||||||
|
@ -2029,7 +2030,12 @@ namespace XamCore.SceneKit {
|
||||||
[Watch (3,0)]
|
[Watch (3,0)]
|
||||||
[Mac (10,8), iOS (8,0)]
|
[Mac (10,8), iOS (8,0)]
|
||||||
[BaseType (typeof (NSObject))]
|
[BaseType (typeof (NSObject))]
|
||||||
interface SCNScene : NSSecureCoding {
|
interface SCNScene :
|
||||||
|
#if (XAMCORE_2_0 || !MONOMAC) && !WATCH
|
||||||
|
GKSceneRootNodeType ,
|
||||||
|
#endif
|
||||||
|
NSSecureCoding {
|
||||||
|
|
||||||
[Static]
|
[Static]
|
||||||
[Export ("scene")]
|
[Export ("scene")]
|
||||||
SCNScene Create ();
|
SCNScene Create ();
|
||||||
|
|
|
@ -521,7 +521,11 @@ namespace XamCore.SpriteKit {
|
||||||
[Mac (10,9, onlyOn64 : true)]
|
[Mac (10,9, onlyOn64 : true)]
|
||||||
[Since (7,0)]
|
[Since (7,0)]
|
||||||
[BaseType (typeof (SKEffectNode))]
|
[BaseType (typeof (SKEffectNode))]
|
||||||
partial interface SKScene {
|
interface SKScene
|
||||||
|
#if (XAMCORE_2_0 || !MONOMAC) && !WATCH
|
||||||
|
: GKSceneRootNodeType
|
||||||
|
#endif
|
||||||
|
{
|
||||||
[Export ("initWithSize:")]
|
[Export ("initWithSize:")]
|
||||||
IntPtr Constructor (CGSize size);
|
IntPtr Constructor (CGSize size);
|
||||||
|
|
||||||
|
|
|
@ -172,6 +172,16 @@ namespace Introspection {
|
||||||
if (!TestRuntime.CheckXcodeVersion (9, 0))
|
if (!TestRuntime.CheckXcodeVersion (9, 0))
|
||||||
return true;
|
return true;
|
||||||
break;
|
break;
|
||||||
|
case "GKSceneRootNodeType":
|
||||||
|
// it's an empty protocol, defined by a category and does not reply as expected
|
||||||
|
switch (type.Name) {
|
||||||
|
// GameplayKit.framework/Headers/SceneKit+Additions.h
|
||||||
|
case "SCNScene":
|
||||||
|
// GameplayKit.framework/Headers/SpriteKit+Additions.h
|
||||||
|
case "SKScene":
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -230,7 +230,10 @@ namespace Introspection {
|
||||||
switch (type.Namespace) {
|
switch (type.Namespace) {
|
||||||
case "MonoMac.SceneKit":
|
case "MonoMac.SceneKit":
|
||||||
case "SceneKit":
|
case "SceneKit":
|
||||||
return IntPtr.Size == 4; // 64bits should be fine
|
// skip on 32 bits but continue otherwise
|
||||||
|
if (IntPtr.Size == 4)
|
||||||
|
return true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return base.Skip (type, protocolName);
|
return base.Skip (type, protocolName);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче