objc2-sprite-kit 0.3.2

Bindings to the SpriteKit framework
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
use objc2_app_kit::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
use objc2_foundation::*;

use crate::*;

/// Blend modes that the SKNode uses to compose with the framebuffer to produce blended colors.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/spritekit/skblendmode?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct SKBlendMode(pub NSInteger);
impl SKBlendMode {
    #[doc(alias = "SKBlendModeAlpha")]
    pub const Alpha: Self = Self(0);
    #[doc(alias = "SKBlendModeAdd")]
    pub const Add: Self = Self(1);
    #[doc(alias = "SKBlendModeSubtract")]
    pub const Subtract: Self = Self(2);
    #[doc(alias = "SKBlendModeMultiply")]
    pub const Multiply: Self = Self(3);
    #[doc(alias = "SKBlendModeMultiplyX2")]
    pub const MultiplyX2: Self = Self(4);
    #[doc(alias = "SKBlendModeScreen")]
    pub const Screen: Self = Self(5);
    #[doc(alias = "SKBlendModeReplace")]
    pub const Replace: Self = Self(6);
    #[doc(alias = "SKBlendModeMultiplyAlpha")]
    pub const MultiplyAlpha: Self = Self(7);
}

unsafe impl Encode for SKBlendMode {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for SKBlendMode {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/spritekit/sknodefocusbehavior?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct SKNodeFocusBehavior(pub NSInteger);
impl SKNodeFocusBehavior {
    #[doc(alias = "SKNodeFocusBehaviorNone")]
    pub const None: Self = Self(0);
    #[doc(alias = "SKNodeFocusBehaviorOccluding")]
    pub const Occluding: Self = Self(1);
    #[doc(alias = "SKNodeFocusBehaviorFocusable")]
    pub const Focusable: Self = Self(2);
}

unsafe impl Encode for SKNodeFocusBehavior {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for SKNodeFocusBehavior {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/spritekit/sknode?language=objc)
    #[unsafe(super(NSResponder, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "objc2-app-kit")]
    #[cfg(target_os = "macos")]
    pub struct SKNode;
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSCoding for SKNode {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSCopying for SKNode {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
unsafe impl CopyingHelper for SKNode {
    type Result = Self;
}

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSObjectProtocol for SKNode {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSSecureCoding for SKNode {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
impl SKNode {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        /// Support coding and decoding via NSKeyedArchiver.
        ///
        /// # Safety
        ///
        /// `a_decoder` possibly has further requirements.
        #[unsafe(method(initWithCoder:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCoder(
            this: Allocated<Self>,
            a_decoder: &NSCoder,
        ) -> Option<Retained<Self>>;

        #[unsafe(method(node))]
        #[unsafe(method_family = none)]
        pub unsafe fn node(mtm: MainThreadMarker) -> Retained<Self>;

        #[unsafe(method(nodeWithFileNamed:))]
        #[unsafe(method_family = none)]
        pub unsafe fn nodeWithFileNamed(
            filename: &NSString,
            mtm: MainThreadMarker,
        ) -> Option<Retained<Self>>;

        /// # Safety
        ///
        /// `classes` generic probably has further requirements.
        #[unsafe(method(nodeWithFileNamed:securelyWithClasses:andError:_))]
        #[unsafe(method_family = none)]
        pub unsafe fn nodeWithFileNamed_securelyWithClasses_andError(
            filename: &NSString,
            classes: &NSSet<AnyClass>,
            mtm: MainThreadMarker,
        ) -> Result<Retained<Self>, Retained<NSError>>;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(frame))]
        #[unsafe(method_family = none)]
        pub unsafe fn frame(&self) -> CGRect;

        #[cfg(feature = "objc2-core-foundation")]
        /// Calculates the bounding box including all child nodes in parents coordinate system.
        #[unsafe(method(calculateAccumulatedFrame))]
        #[unsafe(method_family = none)]
        pub unsafe fn calculateAccumulatedFrame(&self) -> CGRect;

        #[cfg(feature = "objc2-core-foundation")]
        /// The position of the node in the parent's coordinate system
        #[unsafe(method(position))]
        #[unsafe(method_family = none)]
        pub unsafe fn position(&self) -> CGPoint;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`position`][Self::position].
        #[unsafe(method(setPosition:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setPosition(&self, position: CGPoint);

        #[cfg(feature = "objc2-core-foundation")]
        /// The z-order of the node (used for ordering). Negative z is "into" the screen, Positive z is "out" of the screen. A greater zPosition will sort in front of a lesser zPosition.
        #[unsafe(method(zPosition))]
        #[unsafe(method_family = none)]
        pub unsafe fn zPosition(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`zPosition`][Self::zPosition].
        #[unsafe(method(setZPosition:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setZPosition(&self, z_position: CGFloat);

        #[cfg(feature = "objc2-core-foundation")]
        /// The Euler rotation about the z axis (in radians)
        #[unsafe(method(zRotation))]
        #[unsafe(method_family = none)]
        pub unsafe fn zRotation(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`zRotation`][Self::zRotation].
        #[unsafe(method(setZRotation:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setZRotation(&self, z_rotation: CGFloat);

        #[cfg(feature = "objc2-core-foundation")]
        /// The scaling in the X axis
        #[unsafe(method(xScale))]
        #[unsafe(method_family = none)]
        pub unsafe fn xScale(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`xScale`][Self::xScale].
        #[unsafe(method(setXScale:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setXScale(&self, x_scale: CGFloat);

        #[cfg(feature = "objc2-core-foundation")]
        /// The scaling in the Y axis
        #[unsafe(method(yScale))]
        #[unsafe(method_family = none)]
        pub unsafe fn yScale(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`yScale`][Self::yScale].
        #[unsafe(method(setYScale:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setYScale(&self, y_scale: CGFloat);

        #[cfg(feature = "objc2-core-foundation")]
        /// The speed multiplier applied to all actions run on this node. Inherited by its children.
        #[unsafe(method(speed))]
        #[unsafe(method_family = none)]
        pub unsafe fn speed(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`speed`][Self::speed].
        #[unsafe(method(setSpeed:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setSpeed(&self, speed: CGFloat);

        #[cfg(feature = "objc2-core-foundation")]
        /// Alpha of this node (multiplied by the output color to give the final result)
        #[unsafe(method(alpha))]
        #[unsafe(method_family = none)]
        pub unsafe fn alpha(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`alpha`][Self::alpha].
        #[unsafe(method(setAlpha:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setAlpha(&self, alpha: CGFloat);

        /// Controls whether or not the node's actions is updated or paused.
        #[unsafe(method(isPaused))]
        #[unsafe(method_family = none)]
        pub unsafe fn isPaused(&self) -> bool;

        /// Setter for [`isPaused`][Self::isPaused].
        #[unsafe(method(setPaused:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setPaused(&self, paused: bool);

        /// Controls whether or not the node and its children are rendered.
        #[unsafe(method(isHidden))]
        #[unsafe(method_family = none)]
        pub unsafe fn isHidden(&self) -> bool;

        /// Setter for [`isHidden`][Self::isHidden].
        #[unsafe(method(setHidden:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setHidden(&self, hidden: bool);

        /// Controls whether or not the node receives touch events
        #[unsafe(method(isUserInteractionEnabled))]
        #[unsafe(method_family = none)]
        pub unsafe fn isUserInteractionEnabled(&self) -> bool;

        /// Setter for [`isUserInteractionEnabled`][Self::isUserInteractionEnabled].
        #[unsafe(method(setUserInteractionEnabled:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setUserInteractionEnabled(&self, user_interaction_enabled: bool);

        /// Determines how this node participates in the focus system.  The default is SKNodeFocusBehaviorNone.
        #[unsafe(method(focusBehavior))]
        #[unsafe(method_family = none)]
        pub unsafe fn focusBehavior(&self) -> SKNodeFocusBehavior;

        /// Setter for [`focusBehavior`][Self::focusBehavior].
        #[unsafe(method(setFocusBehavior:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setFocusBehavior(&self, focus_behavior: SKNodeFocusBehavior);

        /// The parent of the node.
        ///
        /// If this is nil the node has not been added to another group and is thus the root node of its own graph.
        #[unsafe(method(parent))]
        #[unsafe(method_family = none)]
        pub unsafe fn parent(&self) -> Option<Retained<SKNode>>;

        /// The children of this node.
        #[unsafe(method(children))]
        #[unsafe(method_family = none)]
        pub unsafe fn children(&self) -> Retained<NSArray<SKNode>>;

        /// The client assignable name.
        ///
        /// In general, this should be unique among peers in the scene graph.
        #[unsafe(method(name))]
        #[unsafe(method_family = none)]
        pub unsafe fn name(&self) -> Option<Retained<NSString>>;

        /// Setter for [`name`][Self::name].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setName:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setName(&self, name: Option<&NSString>);

        #[cfg(all(feature = "SKEffectNode", feature = "SKScene"))]
        /// The scene that the node is currently in.
        #[unsafe(method(scene))]
        #[unsafe(method_family = none)]
        pub unsafe fn scene(&self) -> Option<Retained<SKScene>>;

        #[cfg(feature = "SKPhysicsBody")]
        /// Physics body attached to the node, with synchronized scale, rotation, and position
        #[unsafe(method(physicsBody))]
        #[unsafe(method_family = none)]
        pub unsafe fn physicsBody(&self) -> Option<Retained<SKPhysicsBody>>;

        #[cfg(feature = "SKPhysicsBody")]
        /// Setter for [`physicsBody`][Self::physicsBody].
        #[unsafe(method(setPhysicsBody:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setPhysicsBody(&self, physics_body: Option<&SKPhysicsBody>);

        /// An optional dictionary that can be used to store your own data in a node. Defaults to nil.
        ///
        /// # Safety
        ///
        /// The returned generic should be of the correct type.
        #[unsafe(method(userData))]
        #[unsafe(method_family = none)]
        pub unsafe fn userData(&self) -> Option<Retained<NSMutableDictionary>>;

        /// Setter for [`userData`][Self::userData].
        ///
        /// # Safety
        ///
        /// `user_data` generic should be of the correct type.
        #[unsafe(method(setUserData:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setUserData(&self, user_data: Option<&NSMutableDictionary>);

        #[cfg(feature = "SKReachConstraints")]
        /// Kinematic constraints, used in IK solving
        #[unsafe(method(reachConstraints))]
        #[unsafe(method_family = none)]
        pub unsafe fn reachConstraints(&self) -> Option<Retained<SKReachConstraints>>;

        #[cfg(feature = "SKReachConstraints")]
        /// Setter for [`reachConstraints`][Self::reachConstraints].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setReachConstraints:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setReachConstraints(&self, reach_constraints: Option<&SKReachConstraints>);

        #[cfg(feature = "SKConstraint")]
        /// Optional array of SKConstraints
        /// Constraints are evaluated each frame after actions and physics.
        /// The node's transform will be changed to satisfy the constraint.
        #[unsafe(method(constraints))]
        #[unsafe(method_family = none)]
        pub unsafe fn constraints(&self) -> Option<Retained<NSArray<SKConstraint>>>;

        #[cfg(feature = "SKConstraint")]
        /// Setter for [`constraints`][Self::constraints].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setConstraints:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setConstraints(&self, constraints: Option<&NSArray<SKConstraint>>);

        #[cfg(feature = "SKAttribute")]
        /// Optional dictionary of SKAttributeValues
        /// Attributes can be used with custom SKShaders.
        /// DEPRECATED: Attributes are only available for node classes supporting SKShader (see SKSpriteNode etc.).
        #[deprecated]
        #[unsafe(method(attributeValues))]
        #[unsafe(method_family = none)]
        pub unsafe fn attributeValues(&self) -> Retained<NSDictionary<NSString, SKAttributeValue>>;

        #[cfg(feature = "SKAttribute")]
        /// Setter for [`attributeValues`][Self::attributeValues].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[deprecated]
        #[unsafe(method(setAttributeValues:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setAttributeValues(
            &self,
            attribute_values: &NSDictionary<NSString, SKAttributeValue>,
        );

        #[cfg(feature = "SKAttribute")]
        #[deprecated]
        #[unsafe(method(valueForAttributeNamed:))]
        #[unsafe(method_family = none)]
        pub unsafe fn valueForAttributeNamed(
            &self,
            key: &NSString,
        ) -> Option<Retained<SKAttributeValue>>;

        #[cfg(feature = "SKAttribute")]
        #[deprecated]
        #[unsafe(method(setValue:forAttributeNamed:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setValue_forAttributeNamed(&self, value: &SKAttributeValue, key: &NSString);

        #[cfg(feature = "objc2-core-foundation")]
        /// Sets both the x
        /// &
        /// y scale
        ///
        ///
        /// Parameter `scale`: the uniform scale to set.
        #[unsafe(method(setScale:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setScale(&self, scale: CGFloat);

        /// Adds a node as a child node of this node
        ///
        /// The added node must not have a parent.
        ///
        ///
        /// Parameter `node`: the child node to add.
        #[unsafe(method(addChild:))]
        #[unsafe(method_family = none)]
        pub unsafe fn addChild(&self, node: &SKNode);

        #[unsafe(method(insertChild:atIndex:))]
        #[unsafe(method_family = none)]
        pub unsafe fn insertChild_atIndex(&self, node: &SKNode, index: NSInteger);

        #[unsafe(method(removeChildrenInArray:))]
        #[unsafe(method_family = none)]
        pub unsafe fn removeChildrenInArray(&self, nodes: &NSArray<SKNode>);

        #[unsafe(method(removeAllChildren))]
        #[unsafe(method_family = none)]
        pub unsafe fn removeAllChildren(&self);

        #[unsafe(method(removeFromParent))]
        #[unsafe(method_family = none)]
        pub unsafe fn removeFromParent(&self);

        #[unsafe(method(moveToParent:))]
        #[unsafe(method_family = none)]
        pub unsafe fn moveToParent(&self, parent: &SKNode);

        #[unsafe(method(childNodeWithName:))]
        #[unsafe(method_family = none)]
        pub unsafe fn childNodeWithName(&self, name: &NSString) -> Option<Retained<SKNode>>;

        #[cfg(feature = "block2")]
        #[unsafe(method(enumerateChildNodesWithName:usingBlock:))]
        #[unsafe(method_family = none)]
        pub unsafe fn enumerateChildNodesWithName_usingBlock(
            &self,
            name: &NSString,
            block: &block2::DynBlock<dyn Fn(NonNull<SKNode>, NonNull<Bool>)>,
        );

        /// Simplified shorthand for enumerateChildNodesWithName that returns an array of the matching nodes.
        /// This allows subscripting of the form:
        /// NSArray *childrenMatchingName = node[
        /// "
        /// name"]
        ///
        /// or even complex like:
        /// NSArray *siblingsBeginningWithA = node[
        /// "
        /// ../a*"]
        ///
        ///
        /// Parameter `name`: An Xpath style path that can include simple regular expressions for matching node names.
        ///
        /// See: enumerateChildNodesWithName:usingBlock:
        #[unsafe(method(objectForKeyedSubscript:))]
        #[unsafe(method_family = none)]
        pub unsafe fn objectForKeyedSubscript(&self, name: &NSString) -> Retained<NSArray<SKNode>>;

        #[unsafe(method(inParentHierarchy:))]
        #[unsafe(method_family = none)]
        pub unsafe fn inParentHierarchy(&self, parent: &SKNode) -> bool;

        #[cfg(feature = "SKAction")]
        #[unsafe(method(runAction:))]
        #[unsafe(method_family = none)]
        pub unsafe fn runAction(&self, action: &SKAction);

        #[cfg(all(feature = "SKAction", feature = "block2"))]
        #[unsafe(method(runAction:completion:))]
        #[unsafe(method_family = none)]
        pub unsafe fn runAction_completion(
            &self,
            action: &SKAction,
            block: &block2::DynBlock<dyn Fn()>,
        );

        #[cfg(feature = "SKAction")]
        #[unsafe(method(runAction:withKey:))]
        #[unsafe(method_family = none)]
        pub unsafe fn runAction_withKey(&self, action: &SKAction, key: &NSString);

        #[unsafe(method(hasActions))]
        #[unsafe(method_family = none)]
        pub unsafe fn hasActions(&self) -> bool;

        #[cfg(feature = "SKAction")]
        #[unsafe(method(actionForKey:))]
        #[unsafe(method_family = none)]
        pub unsafe fn actionForKey(&self, key: &NSString) -> Option<Retained<SKAction>>;

        #[unsafe(method(removeActionForKey:))]
        #[unsafe(method_family = none)]
        pub unsafe fn removeActionForKey(&self, key: &NSString);

        #[unsafe(method(removeAllActions))]
        #[unsafe(method_family = none)]
        pub unsafe fn removeAllActions(&self);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(containsPoint:))]
        #[unsafe(method_family = none)]
        pub unsafe fn containsPoint(&self, p: CGPoint) -> bool;

        #[cfg(feature = "objc2-core-foundation")]
        /// Returns the node itself or a child node at the point given.
        /// If the receiver is returned there is no child node at the given point.
        ///
        /// Returns: a child node or self at the given location.
        #[unsafe(method(nodeAtPoint:))]
        #[unsafe(method_family = none)]
        pub unsafe fn nodeAtPoint(&self, p: CGPoint) -> Retained<SKNode>;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(nodesAtPoint:))]
        #[unsafe(method_family = none)]
        pub unsafe fn nodesAtPoint(&self, p: CGPoint) -> Retained<NSArray<SKNode>>;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(convertPoint:fromNode:))]
        #[unsafe(method_family = none)]
        pub unsafe fn convertPoint_fromNode(&self, point: CGPoint, node: &SKNode) -> CGPoint;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(convertPoint:toNode:))]
        #[unsafe(method_family = none)]
        pub unsafe fn convertPoint_toNode(&self, point: CGPoint, node: &SKNode) -> CGPoint;

        #[unsafe(method(intersectsNode:))]
        #[unsafe(method_family = none)]
        pub unsafe fn intersectsNode(&self, node: &SKNode) -> bool;

        #[unsafe(method(isEqualToNode:))]
        #[unsafe(method_family = none)]
        pub unsafe fn isEqualToNode(&self, node: &SKNode) -> bool;
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
impl SKNode {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
    );
}

mod private_NSEventSKNodeEvent {
    pub trait Sealed {}
}

/// Category "SKNodeEvent" on [`NSEvent`].
#[doc(alias = "SKNodeEvent")]
pub unsafe trait NSEventSKNodeEvent:
    ClassType + Sized + private_NSEventSKNodeEvent::Sealed
{
    extern_methods!(
        #[cfg(all(feature = "objc2-app-kit", feature = "objc2-core-foundation"))]
        #[cfg(target_os = "macos")]
        #[unsafe(method(locationInNode:))]
        #[unsafe(method_family = none)]
        unsafe fn locationInNode(&self, node: &SKNode) -> CGPoint;
    );
}

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
impl private_NSEventSKNodeEvent::Sealed for NSEvent {}
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
unsafe impl NSEventSKNodeEvent for NSEvent {}