objc2_sprite_kit/generated/
SKAttribute.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10/// [Apple's documentation](https://developer.apple.com/documentation/spritekit/skattributetype?language=objc)
11// NS_ENUM
12#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct SKAttributeType(pub NSInteger);
15impl SKAttributeType {
16    #[doc(alias = "SKAttributeTypeNone")]
17    pub const None: Self = Self(0);
18    #[doc(alias = "SKAttributeTypeFloat")]
19    pub const Float: Self = Self(1);
20    #[doc(alias = "SKAttributeTypeVectorFloat2")]
21    pub const VectorFloat2: Self = Self(2);
22    #[doc(alias = "SKAttributeTypeVectorFloat3")]
23    pub const VectorFloat3: Self = Self(3);
24    #[doc(alias = "SKAttributeTypeVectorFloat4")]
25    pub const VectorFloat4: Self = Self(4);
26    #[doc(alias = "SKAttributeTypeHalfFloat")]
27    pub const HalfFloat: Self = Self(5);
28    #[doc(alias = "SKAttributeTypeVectorHalfFloat2")]
29    pub const VectorHalfFloat2: Self = Self(6);
30    #[doc(alias = "SKAttributeTypeVectorHalfFloat3")]
31    pub const VectorHalfFloat3: Self = Self(7);
32    #[doc(alias = "SKAttributeTypeVectorHalfFloat4")]
33    pub const VectorHalfFloat4: Self = Self(8);
34}
35
36unsafe impl Encode for SKAttributeType {
37    const ENCODING: Encoding = NSInteger::ENCODING;
38}
39
40unsafe impl RefEncode for SKAttributeType {
41    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
42}
43
44extern_class!(
45    /// [Apple's documentation](https://developer.apple.com/documentation/spritekit/skattribute?language=objc)
46    #[unsafe(super(NSObject))]
47    #[derive(Debug, PartialEq, Eq, Hash)]
48    pub struct SKAttribute;
49);
50
51unsafe impl NSCoding for SKAttribute {}
52
53unsafe impl NSObjectProtocol for SKAttribute {}
54
55unsafe impl NSSecureCoding for SKAttribute {}
56
57impl SKAttribute {
58    extern_methods!(
59        #[unsafe(method(attributeWithName:type:))]
60        #[unsafe(method_family = none)]
61        pub unsafe fn attributeWithName_type(
62            name: &NSString,
63            r#type: SKAttributeType,
64        ) -> Retained<Self>;
65
66        #[unsafe(method(initWithName:type:))]
67        #[unsafe(method_family = init)]
68        pub unsafe fn initWithName_type(
69            this: Allocated<Self>,
70            name: &NSString,
71            r#type: SKAttributeType,
72        ) -> Retained<Self>;
73
74        #[unsafe(method(name))]
75        #[unsafe(method_family = none)]
76        pub unsafe fn name(&self) -> Retained<NSString>;
77
78        #[unsafe(method(type))]
79        #[unsafe(method_family = none)]
80        pub unsafe fn r#type(&self) -> SKAttributeType;
81    );
82}
83
84/// Methods declared on superclass `NSObject`.
85impl SKAttribute {
86    extern_methods!(
87        #[unsafe(method(init))]
88        #[unsafe(method_family = init)]
89        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
90
91        #[unsafe(method(new))]
92        #[unsafe(method_family = new)]
93        pub unsafe fn new() -> Retained<Self>;
94    );
95}
96
97extern_class!(
98    /// [Apple's documentation](https://developer.apple.com/documentation/spritekit/skattributevalue?language=objc)
99    #[unsafe(super(NSObject))]
100    #[derive(Debug, PartialEq, Eq, Hash)]
101    pub struct SKAttributeValue;
102);
103
104unsafe impl NSCoding for SKAttributeValue {}
105
106unsafe impl NSObjectProtocol for SKAttributeValue {}
107
108unsafe impl NSSecureCoding for SKAttributeValue {}
109
110impl SKAttributeValue {
111    extern_methods!(
112        #[unsafe(method(valueWithFloat:))]
113        #[unsafe(method_family = none)]
114        pub unsafe fn valueWithFloat(value: c_float) -> Retained<Self>;
115
116        #[unsafe(method(init))]
117        #[unsafe(method_family = init)]
118        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
119
120        #[unsafe(method(floatValue))]
121        #[unsafe(method_family = none)]
122        pub unsafe fn floatValue(&self) -> c_float;
123
124        /// Setter for [`floatValue`][Self::floatValue].
125        #[unsafe(method(setFloatValue:))]
126        #[unsafe(method_family = none)]
127        pub unsafe fn setFloatValue(&self, float_value: c_float);
128    );
129}
130
131/// Methods declared on superclass `NSObject`.
132impl SKAttributeValue {
133    extern_methods!(
134        #[unsafe(method(new))]
135        #[unsafe(method_family = new)]
136        pub unsafe fn new() -> Retained<Self>;
137    );
138}