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::*;
#[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);
}
#[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!(
#[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>;
#[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>>;
#[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")]
#[unsafe(method(calculateAccumulatedFrame))]
#[unsafe(method_family = none)]
pub unsafe fn calculateAccumulatedFrame(&self) -> CGRect;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(position))]
#[unsafe(method_family = none)]
pub unsafe fn position(&self) -> CGPoint;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setPosition:))]
#[unsafe(method_family = none)]
pub unsafe fn setPosition(&self, position: CGPoint);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(zPosition))]
#[unsafe(method_family = none)]
pub unsafe fn zPosition(&self) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setZPosition:))]
#[unsafe(method_family = none)]
pub unsafe fn setZPosition(&self, z_position: CGFloat);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(zRotation))]
#[unsafe(method_family = none)]
pub unsafe fn zRotation(&self) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setZRotation:))]
#[unsafe(method_family = none)]
pub unsafe fn setZRotation(&self, z_rotation: CGFloat);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(xScale))]
#[unsafe(method_family = none)]
pub unsafe fn xScale(&self) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setXScale:))]
#[unsafe(method_family = none)]
pub unsafe fn setXScale(&self, x_scale: CGFloat);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(yScale))]
#[unsafe(method_family = none)]
pub unsafe fn yScale(&self) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setYScale:))]
#[unsafe(method_family = none)]
pub unsafe fn setYScale(&self, y_scale: CGFloat);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(speed))]
#[unsafe(method_family = none)]
pub unsafe fn speed(&self) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setSpeed:))]
#[unsafe(method_family = none)]
pub unsafe fn setSpeed(&self, speed: CGFloat);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(alpha))]
#[unsafe(method_family = none)]
pub unsafe fn alpha(&self) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setAlpha:))]
#[unsafe(method_family = none)]
pub unsafe fn setAlpha(&self, alpha: CGFloat);
#[unsafe(method(isPaused))]
#[unsafe(method_family = none)]
pub unsafe fn isPaused(&self) -> bool;
#[unsafe(method(setPaused:))]
#[unsafe(method_family = none)]
pub unsafe fn setPaused(&self, paused: bool);
#[unsafe(method(isHidden))]
#[unsafe(method_family = none)]
pub unsafe fn isHidden(&self) -> bool;
#[unsafe(method(setHidden:))]
#[unsafe(method_family = none)]
pub unsafe fn setHidden(&self, hidden: bool);
#[unsafe(method(isUserInteractionEnabled))]
#[unsafe(method_family = none)]
pub unsafe fn isUserInteractionEnabled(&self) -> bool;
#[unsafe(method(setUserInteractionEnabled:))]
#[unsafe(method_family = none)]
pub unsafe fn setUserInteractionEnabled(&self, user_interaction_enabled: bool);
#[unsafe(method(focusBehavior))]
#[unsafe(method_family = none)]
pub unsafe fn focusBehavior(&self) -> SKNodeFocusBehavior;
#[unsafe(method(setFocusBehavior:))]
#[unsafe(method_family = none)]
pub unsafe fn setFocusBehavior(&self, focus_behavior: SKNodeFocusBehavior);
#[unsafe(method(parent))]
#[unsafe(method_family = none)]
pub unsafe fn parent(&self) -> Option<Retained<SKNode>>;
#[unsafe(method(children))]
#[unsafe(method_family = none)]
pub unsafe fn children(&self) -> Retained<NSArray<SKNode>>;
#[unsafe(method(name))]
#[unsafe(method_family = none)]
pub unsafe fn name(&self) -> Option<Retained<NSString>>;
#[unsafe(method(setName:))]
#[unsafe(method_family = none)]
pub unsafe fn setName(&self, name: Option<&NSString>);
#[cfg(all(feature = "SKEffectNode", feature = "SKScene"))]
#[unsafe(method(scene))]
#[unsafe(method_family = none)]
pub unsafe fn scene(&self) -> Option<Retained<SKScene>>;
#[cfg(feature = "SKPhysicsBody")]
#[unsafe(method(physicsBody))]
#[unsafe(method_family = none)]
pub unsafe fn physicsBody(&self) -> Option<Retained<SKPhysicsBody>>;
#[cfg(feature = "SKPhysicsBody")]
#[unsafe(method(setPhysicsBody:))]
#[unsafe(method_family = none)]
pub unsafe fn setPhysicsBody(&self, physics_body: Option<&SKPhysicsBody>);
#[unsafe(method(userData))]
#[unsafe(method_family = none)]
pub unsafe fn userData(&self) -> Option<Retained<NSMutableDictionary>>;
#[unsafe(method(setUserData:))]
#[unsafe(method_family = none)]
pub unsafe fn setUserData(&self, user_data: Option<&NSMutableDictionary>);
#[cfg(feature = "SKReachConstraints")]
#[unsafe(method(reachConstraints))]
#[unsafe(method_family = none)]
pub unsafe fn reachConstraints(&self) -> Option<Retained<SKReachConstraints>>;
#[cfg(feature = "SKReachConstraints")]
#[unsafe(method(setReachConstraints:))]
#[unsafe(method_family = none)]
pub unsafe fn setReachConstraints(&self, reach_constraints: Option<&SKReachConstraints>);
#[cfg(feature = "SKConstraint")]
#[unsafe(method(constraints))]
#[unsafe(method_family = none)]
pub unsafe fn constraints(&self) -> Option<Retained<NSArray<SKConstraint>>>;
#[cfg(feature = "SKConstraint")]
#[unsafe(method(setConstraints:))]
#[unsafe(method_family = none)]
pub unsafe fn setConstraints(&self, constraints: Option<&NSArray<SKConstraint>>);
#[cfg(feature = "SKAttribute")]
#[deprecated]
#[unsafe(method(attributeValues))]
#[unsafe(method_family = none)]
pub unsafe fn attributeValues(&self) -> Retained<NSDictionary<NSString, SKAttributeValue>>;
#[cfg(feature = "SKAttribute")]
#[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")]
#[unsafe(method(setScale:))]
#[unsafe(method_family = none)]
pub unsafe fn setScale(&self, scale: CGFloat);
#[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>)>,
);
#[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")]
#[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;
);
}
#[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 {}
}
#[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 {}