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::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/spritekit/skwarpable?language=objc)
    pub unsafe trait SKWarpable: NSObjectProtocol {
        #[unsafe(method(warpGeometry))]
        #[unsafe(method_family = none)]
        unsafe fn warpGeometry(&self) -> Option<Retained<SKWarpGeometry>>;

        /// Setter for [`warpGeometry`][Self::warpGeometry].
        #[unsafe(method(setWarpGeometry:))]
        #[unsafe(method_family = none)]
        unsafe fn setWarpGeometry(&self, warp_geometry: Option<&SKWarpGeometry>);

        #[unsafe(method(subdivisionLevels))]
        #[unsafe(method_family = none)]
        unsafe fn subdivisionLevels(&self) -> NSInteger;

        /// Setter for [`subdivisionLevels`][Self::subdivisionLevels].
        #[unsafe(method(setSubdivisionLevels:))]
        #[unsafe(method_family = none)]
        unsafe fn setSubdivisionLevels(&self, subdivision_levels: NSInteger);
    }
);

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/spritekit/skwarpgeometry?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct SKWarpGeometry;
);

extern_conformance!(
    unsafe impl NSCoding for SKWarpGeometry {}
);

extern_conformance!(
    unsafe impl NSCopying for SKWarpGeometry {}
);

unsafe impl CopyingHelper for SKWarpGeometry {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for SKWarpGeometry {}
);

extern_conformance!(
    unsafe impl NSSecureCoding for SKWarpGeometry {}
);

impl SKWarpGeometry {
    extern_methods!();
}

/// Methods declared on superclass `NSObject`.
impl SKWarpGeometry {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/spritekit/skwarpgeometrygrid?language=objc)
    #[unsafe(super(SKWarpGeometry, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct SKWarpGeometryGrid;
);

extern_conformance!(
    unsafe impl NSCoding for SKWarpGeometryGrid {}
);

extern_conformance!(
    unsafe impl NSCopying for SKWarpGeometryGrid {}
);

unsafe impl CopyingHelper for SKWarpGeometryGrid {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for SKWarpGeometryGrid {}
);

extern_conformance!(
    unsafe impl NSSecureCoding for SKWarpGeometryGrid {}
);

impl SKWarpGeometryGrid {
    extern_methods!(
        /// # 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(grid))]
        #[unsafe(method_family = none)]
        pub unsafe fn grid() -> Retained<Self>;

        #[unsafe(method(gridWithColumns:rows:))]
        #[unsafe(method_family = none)]
        pub unsafe fn gridWithColumns_rows(cols: NSInteger, rows: NSInteger) -> Retained<Self>;

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

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

        #[unsafe(method(vertexCount))]
        #[unsafe(method_family = none)]
        pub unsafe fn vertexCount(&self) -> NSInteger;
    );
}

/// Methods declared on superclass `NSObject`.
impl SKWarpGeometryGrid {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

/// SKWarpable.
#[cfg(feature = "SKAction")]
impl SKAction {
    extern_methods!(
        #[unsafe(method(warpTo:duration:))]
        #[unsafe(method_family = none)]
        pub unsafe fn warpTo_duration(
            warp: &SKWarpGeometry,
            duration: NSTimeInterval,
        ) -> Option<Retained<SKAction>>;

        #[unsafe(method(animateWithWarps:times:))]
        #[unsafe(method_family = none)]
        pub unsafe fn animateWithWarps_times(
            warps: &NSArray<SKWarpGeometry>,
            times: &NSArray<NSNumber>,
        ) -> Option<Retained<SKAction>>;

        #[unsafe(method(animateWithWarps:times:restore:))]
        #[unsafe(method_family = none)]
        pub unsafe fn animateWithWarps_times_restore(
            warps: &NSArray<SKWarpGeometry>,
            times: &NSArray<NSNumber>,
            restore: bool,
        ) -> Option<Retained<SKAction>>;
    );
}