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::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
use objc2_foundation::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/spritekit/skinterpolationmode?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct SKInterpolationMode(pub NSInteger);
impl SKInterpolationMode {
    #[doc(alias = "SKInterpolationModeLinear")]
    pub const Linear: Self = Self(1);
    #[doc(alias = "SKInterpolationModeSpline")]
    pub const Spline: Self = Self(2);
    #[doc(alias = "SKInterpolationModeStep")]
    pub const Step: Self = Self(3);
}

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

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

/// [Apple's documentation](https://developer.apple.com/documentation/spritekit/skrepeatmode?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct SKRepeatMode(pub NSInteger);
impl SKRepeatMode {
    #[doc(alias = "SKRepeatModeClamp")]
    pub const Clamp: Self = Self(1);
    #[doc(alias = "SKRepeatModeLoop")]
    pub const Loop: Self = Self(2);
}

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

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

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

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

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

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

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

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

impl SKKeyframeSequence {
    extern_methods!(
        /// # Safety
        ///
        /// `values` generic should be of the correct type.
        #[unsafe(method(initWithKeyframeValues:times:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithKeyframeValues_times(
            this: Allocated<Self>,
            values: &NSArray,
            times: &NSArray<NSNumber>,
        ) -> Retained<Self>;

        #[unsafe(method(initWithCapacity:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCapacity(
            this: Allocated<Self>,
            num_items: NSUInteger,
        ) -> 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(count))]
        #[unsafe(method_family = none)]
        pub unsafe fn count(&self) -> NSUInteger;

        #[cfg(feature = "objc2-core-foundation")]
        /// # Safety
        ///
        /// `value` should be of the correct type.
        #[unsafe(method(addKeyframeValue:time:))]
        #[unsafe(method_family = none)]
        pub unsafe fn addKeyframeValue_time(&self, value: &AnyObject, time: CGFloat);

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

        #[unsafe(method(removeKeyframeAtIndex:))]
        #[unsafe(method_family = none)]
        pub unsafe fn removeKeyframeAtIndex(&self, index: NSUInteger);

        /// # Safety
        ///
        /// `value` should be of the correct type.
        #[unsafe(method(setKeyframeValue:forIndex:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setKeyframeValue_forIndex(&self, value: &AnyObject, index: NSUInteger);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(setKeyframeTime:forIndex:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setKeyframeTime_forIndex(&self, time: CGFloat, index: NSUInteger);

        #[cfg(feature = "objc2-core-foundation")]
        /// # Safety
        ///
        /// `value` should be of the correct type.
        #[unsafe(method(setKeyframeValue:time:forIndex:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setKeyframeValue_time_forIndex(
            &self,
            value: &AnyObject,
            time: CGFloat,
            index: NSUInteger,
        );

        #[unsafe(method(getKeyframeValueForIndex:))]
        #[unsafe(method_family = none)]
        pub unsafe fn getKeyframeValueForIndex(&self, index: NSUInteger) -> Retained<AnyObject>;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(getKeyframeTimeForIndex:))]
        #[unsafe(method_family = none)]
        pub unsafe fn getKeyframeTimeForIndex(&self, index: NSUInteger) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(sampleAtTime:))]
        #[unsafe(method_family = none)]
        pub unsafe fn sampleAtTime(&self, time: CGFloat) -> Option<Retained<AnyObject>>;

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

        /// Setter for [`interpolationMode`][Self::interpolationMode].
        #[unsafe(method(setInterpolationMode:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setInterpolationMode(&self, interpolation_mode: SKInterpolationMode);

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

        /// Setter for [`repeatMode`][Self::repeatMode].
        #[unsafe(method(setRepeatMode:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setRepeatMode(&self, repeat_mode: SKRepeatMode);
    );
}

/// Methods declared on superclass `NSObject`.
impl SKKeyframeSequence {
    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>;
    );
}