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::*;

/// [Apple's documentation](https://developer.apple.com/documentation/spritekit/skattributetype?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct SKAttributeType(pub NSInteger);
impl SKAttributeType {
    #[doc(alias = "SKAttributeTypeNone")]
    pub const None: Self = Self(0);
    #[doc(alias = "SKAttributeTypeFloat")]
    pub const Float: Self = Self(1);
    #[doc(alias = "SKAttributeTypeVectorFloat2")]
    pub const VectorFloat2: Self = Self(2);
    #[doc(alias = "SKAttributeTypeVectorFloat3")]
    pub const VectorFloat3: Self = Self(3);
    #[doc(alias = "SKAttributeTypeVectorFloat4")]
    pub const VectorFloat4: Self = Self(4);
    #[doc(alias = "SKAttributeTypeHalfFloat")]
    pub const HalfFloat: Self = Self(5);
    #[doc(alias = "SKAttributeTypeVectorHalfFloat2")]
    pub const VectorHalfFloat2: Self = Self(6);
    #[doc(alias = "SKAttributeTypeVectorHalfFloat3")]
    pub const VectorHalfFloat3: Self = Self(7);
    #[doc(alias = "SKAttributeTypeVectorHalfFloat4")]
    pub const VectorHalfFloat4: Self = Self(8);
}

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

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

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

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

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

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

impl SKAttribute {
    extern_methods!(
        #[unsafe(method(attributeWithName:type:))]
        #[unsafe(method_family = none)]
        pub unsafe fn attributeWithName_type(
            name: &NSString,
            r#type: SKAttributeType,
        ) -> Retained<Self>;

        #[unsafe(method(initWithName:type:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithName_type(
            this: Allocated<Self>,
            name: &NSString,
            r#type: SKAttributeType,
        ) -> Retained<Self>;

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

        #[unsafe(method(type))]
        #[unsafe(method_family = none)]
        pub unsafe fn r#type(&self) -> SKAttributeType;
    );
}

/// Methods declared on superclass `NSObject`.
impl SKAttribute {
    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/skattributevalue?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct SKAttributeValue;
);

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

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

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

impl SKAttributeValue {
    extern_methods!(
        #[unsafe(method(valueWithFloat:))]
        #[unsafe(method_family = none)]
        pub unsafe fn valueWithFloat(value: c_float) -> Retained<Self>;

        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

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

        /// Setter for [`floatValue`][Self::floatValue].
        #[unsafe(method(setFloatValue:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setFloatValue(&self, float_value: c_float);
    );
}

/// Methods declared on superclass `NSObject`.
impl SKAttributeValue {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}