objc2_sprite_kit/generated/
SKUniform.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/skuniformtype?language=objc)
11// NS_ENUM
12#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct SKUniformType(pub NSInteger);
15impl SKUniformType {
16    #[doc(alias = "SKUniformTypeNone")]
17    pub const None: Self = Self(0);
18    #[doc(alias = "SKUniformTypeFloat")]
19    pub const Float: Self = Self(1);
20    #[doc(alias = "SKUniformTypeFloatVector2")]
21    pub const FloatVector2: Self = Self(2);
22    #[doc(alias = "SKUniformTypeFloatVector3")]
23    pub const FloatVector3: Self = Self(3);
24    #[doc(alias = "SKUniformTypeFloatVector4")]
25    pub const FloatVector4: Self = Self(4);
26    #[doc(alias = "SKUniformTypeFloatMatrix2")]
27    pub const FloatMatrix2: Self = Self(5);
28    #[doc(alias = "SKUniformTypeFloatMatrix3")]
29    pub const FloatMatrix3: Self = Self(6);
30    #[doc(alias = "SKUniformTypeFloatMatrix4")]
31    pub const FloatMatrix4: Self = Self(7);
32    #[doc(alias = "SKUniformTypeTexture")]
33    pub const Texture: Self = Self(8);
34}
35
36unsafe impl Encode for SKUniformType {
37    const ENCODING: Encoding = NSInteger::ENCODING;
38}
39
40unsafe impl RefEncode for SKUniformType {
41    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
42}
43
44extern_class!(
45    /// [Apple's documentation](https://developer.apple.com/documentation/spritekit/skuniform?language=objc)
46    #[unsafe(super(NSObject))]
47    #[derive(Debug, PartialEq, Eq, Hash)]
48    pub struct SKUniform;
49);
50
51extern_conformance!(
52    unsafe impl NSCoding for SKUniform {}
53);
54
55extern_conformance!(
56    unsafe impl NSCopying for SKUniform {}
57);
58
59unsafe impl CopyingHelper for SKUniform {
60    type Result = Self;
61}
62
63extern_conformance!(
64    unsafe impl NSObjectProtocol for SKUniform {}
65);
66
67extern_conformance!(
68    unsafe impl NSSecureCoding for SKUniform {}
69);
70
71impl SKUniform {
72    extern_methods!(
73        /// Create a shader uniform with a given name.
74        ///
75        ///
76        /// Parameter `name`: the name of the shader uniform.
77        #[unsafe(method(uniformWithName:))]
78        #[unsafe(method_family = none)]
79        pub unsafe fn uniformWithName(name: &NSString) -> Retained<Self>;
80
81        #[cfg(feature = "SKTexture")]
82        /// Create a shader uniform with a given name, and texture data
83        ///
84        ///
85        /// Parameter `name`: the name of the shader uniform.
86        ///
87        /// Parameter `texture`: the texture data associated with this uniform.
88        #[unsafe(method(uniformWithName:texture:))]
89        #[unsafe(method_family = none)]
90        pub unsafe fn uniformWithName_texture(
91            name: &NSString,
92            texture: Option<&SKTexture>,
93        ) -> Retained<Self>;
94
95        /// Create a shader uniform with a given name, and a float value
96        ///
97        ///
98        /// Parameter `name`: the name of the shader uniform.
99        ///
100        /// Parameter `value`: the floating point value associated with this uniform.
101        #[unsafe(method(uniformWithName:float:))]
102        #[unsafe(method_family = none)]
103        pub unsafe fn uniformWithName_float(name: &NSString, value: c_float) -> Retained<Self>;
104
105        #[unsafe(method(name))]
106        #[unsafe(method_family = none)]
107        pub unsafe fn name(&self) -> Retained<NSString>;
108
109        #[unsafe(method(uniformType))]
110        #[unsafe(method_family = none)]
111        pub unsafe fn uniformType(&self) -> SKUniformType;
112
113        #[cfg(feature = "SKTexture")]
114        #[unsafe(method(textureValue))]
115        #[unsafe(method_family = none)]
116        pub unsafe fn textureValue(&self) -> Option<Retained<SKTexture>>;
117
118        #[cfg(feature = "SKTexture")]
119        /// Setter for [`textureValue`][Self::textureValue].
120        #[unsafe(method(setTextureValue:))]
121        #[unsafe(method_family = none)]
122        pub unsafe fn setTextureValue(&self, texture_value: Option<&SKTexture>);
123
124        #[unsafe(method(floatValue))]
125        #[unsafe(method_family = none)]
126        pub unsafe fn floatValue(&self) -> c_float;
127
128        /// Setter for [`floatValue`][Self::floatValue].
129        #[unsafe(method(setFloatValue:))]
130        #[unsafe(method_family = none)]
131        pub unsafe fn setFloatValue(&self, float_value: c_float);
132
133        #[unsafe(method(initWithName:))]
134        #[unsafe(method_family = init)]
135        pub unsafe fn initWithName(this: Allocated<Self>, name: &NSString) -> Retained<Self>;
136
137        #[cfg(feature = "SKTexture")]
138        #[unsafe(method(initWithName:texture:))]
139        #[unsafe(method_family = init)]
140        pub unsafe fn initWithName_texture(
141            this: Allocated<Self>,
142            name: &NSString,
143            texture: Option<&SKTexture>,
144        ) -> Retained<Self>;
145
146        #[unsafe(method(initWithName:float:))]
147        #[unsafe(method_family = init)]
148        pub unsafe fn initWithName_float(
149            this: Allocated<Self>,
150            name: &NSString,
151            value: c_float,
152        ) -> Retained<Self>;
153    );
154}
155
156/// Methods declared on superclass `NSObject`.
157impl SKUniform {
158    extern_methods!(
159        #[unsafe(method(init))]
160        #[unsafe(method_family = init)]
161        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
162
163        #[unsafe(method(new))]
164        #[unsafe(method_family = new)]
165        pub unsafe fn new() -> Retained<Self>;
166    );
167}