objc2-sprite-kit 0.3.2

Bindings to the SpriteKit framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
use objc2_app_kit::*;
use objc2_foundation::*;

use crate::*;

extern_class!(
    /// A Camera node is a full fledged SKNode that can have actions and physics applied to it.
    /// It also uses the standard SKNode transform system so modifying the camera node's position
    /// is how you translate the camera's viewport. Applying a scale to the node would zoom
    /// the viewport in or out etc. As an added benefit you can now rotate the viewport by
    /// applying a zRotation to the camera node, just as you would with any other SKNode.
    ///
    /// The camera viewport is centered on the camera's position. It uses the scene's frame
    /// and scale mode along with the node transforms to determine the size, origin and
    /// rotation of the viewport.
    ///
    /// There are some convenience functions included for testing if nodes are contained
    /// within the camera viewport. It can be used to determine if objects are no longer
    /// visible on the display.
    ///
    /// In order to use a camera; set it on the scene that contains the camera.
    ///
    /// See: SKScene.camera
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/spritekit/skcameranode?language=objc)
    #[unsafe(super(SKNode, NSResponder, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
    #[cfg(target_os = "macos")]
    pub struct SKCameraNode;
);

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

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

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

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

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

#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
#[cfg(target_os = "macos")]
impl SKCameraNode {
    extern_methods!(
        /// Checks if the node is contained inside the viewport of the camera.
        /// The camera and node must both be in the same scene and presented on a view in order
        /// to determine if the node is inside the camera viewport rectangle.
        ///
        ///
        /// Returns: YES if the node is inside the viewport. NO if node is nil or the node is outside the viewport.
        #[unsafe(method(containsNode:))]
        #[unsafe(method_family = none)]
        pub unsafe fn containsNode(&self, node: &SKNode) -> bool;

        /// Returns the set of nodes in the same scene as the camera that are contained within its viewport.
        ///
        /// Returns: the set of nodes contained
        #[unsafe(method(containedNodeSet))]
        #[unsafe(method_family = none)]
        pub unsafe fn containedNodeSet(&self) -> Retained<NSSet<SKNode>>;
    );
}

/// Methods declared on superclass `SKNode`.
#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
#[cfg(target_os = "macos")]
impl SKCameraNode {
    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>>;
    );
}

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