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
51extern_conformance!(
52    unsafe impl NSCoding for SKAttribute {}
53);
54
55extern_conformance!(
56    unsafe impl NSObjectProtocol for SKAttribute {}
57);
58
59extern_conformance!(
60    unsafe impl NSSecureCoding for SKAttribute {}
61);
62
63impl SKAttribute {
64    extern_methods!(
65        #[unsafe(method(attributeWithName:type:))]
66        #[unsafe(method_family = none)]
67        pub unsafe fn attributeWithName_type(
68            name: &NSString,
69            r#type: SKAttributeType,
70        ) -> Retained<Self>;
71
72        #[unsafe(method(initWithName:type:))]
73        #[unsafe(method_family = init)]
74        pub unsafe fn initWithName_type(
75            this: Allocated<Self>,
76            name: &NSString,
77            r#type: SKAttributeType,
78        ) -> Retained<Self>;
79
80        #[unsafe(method(name))]
81        #[unsafe(method_family = none)]
82        pub unsafe fn name(&self) -> Retained<NSString>;
83
84        #[unsafe(method(type))]
85        #[unsafe(method_family = none)]
86        pub unsafe fn r#type(&self) -> SKAttributeType;
87    );
88}
89
90/// Methods declared on superclass `NSObject`.
91impl SKAttribute {
92    extern_methods!(
93        #[unsafe(method(init))]
94        #[unsafe(method_family = init)]
95        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
96
97        #[unsafe(method(new))]
98        #[unsafe(method_family = new)]
99        pub unsafe fn new() -> Retained<Self>;
100    );
101}
102
103extern_class!(
104    /// [Apple's documentation](https://developer.apple.com/documentation/spritekit/skattributevalue?language=objc)
105    #[unsafe(super(NSObject))]
106    #[derive(Debug, PartialEq, Eq, Hash)]
107    pub struct SKAttributeValue;
108);
109
110extern_conformance!(
111    unsafe impl NSCoding for SKAttributeValue {}
112);
113
114extern_conformance!(
115    unsafe impl NSObjectProtocol for SKAttributeValue {}
116);
117
118extern_conformance!(
119    unsafe impl NSSecureCoding for SKAttributeValue {}
120);
121
122impl SKAttributeValue {
123    extern_methods!(
124        #[unsafe(method(valueWithFloat:))]
125        #[unsafe(method_family = none)]
126        pub unsafe fn valueWithFloat(value: c_float) -> Retained<Self>;
127
128        #[unsafe(method(init))]
129        #[unsafe(method_family = init)]
130        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
131
132        #[unsafe(method(floatValue))]
133        #[unsafe(method_family = none)]
134        pub unsafe fn floatValue(&self) -> c_float;
135
136        /// Setter for [`floatValue`][Self::floatValue].
137        #[unsafe(method(setFloatValue:))]
138        #[unsafe(method_family = none)]
139        pub unsafe fn setFloatValue(&self, float_value: c_float);
140    );
141}
142
143/// Methods declared on superclass `NSObject`.
144impl SKAttributeValue {
145    extern_methods!(
146        #[unsafe(method(new))]
147        #[unsafe(method_family = new)]
148        pub unsafe fn new() -> Retained<Self>;
149    );
150}