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
51unsafe impl NSCoding for SKUniform {}
52
53unsafe impl NSCopying for SKUniform {}
54
55unsafe impl CopyingHelper for SKUniform {
56    type Result = Self;
57}
58
59unsafe impl NSObjectProtocol for SKUniform {}
60
61unsafe impl NSSecureCoding for SKUniform {}
62
63impl SKUniform {
64    extern_methods!(
65        /// Create a shader uniform with a given name.
66        ///
67        ///
68        /// Parameter `name`: the name of the shader uniform.
69        #[unsafe(method(uniformWithName:))]
70        #[unsafe(method_family = none)]
71        pub unsafe fn uniformWithName(name: &NSString) -> Retained<Self>;
72
73        #[cfg(feature = "SKTexture")]
74        /// Create a shader uniform with a given name, and texture data
75        ///
76        ///
77        /// Parameter `name`: the name of the shader uniform.
78        ///
79        /// Parameter `texture`: the texture data associated with this uniform.
80        #[unsafe(method(uniformWithName:texture:))]
81        #[unsafe(method_family = none)]
82        pub unsafe fn uniformWithName_texture(
83            name: &NSString,
84            texture: Option<&SKTexture>,
85        ) -> Retained<Self>;
86
87        /// Create a shader uniform with a given name, and a float value
88        ///
89        ///
90        /// Parameter `name`: the name of the shader uniform.
91        ///
92        /// Parameter `value`: the floating point value associated with this uniform.
93        #[unsafe(method(uniformWithName:float:))]
94        #[unsafe(method_family = none)]
95        pub unsafe fn uniformWithName_float(name: &NSString, value: c_float) -> Retained<Self>;
96
97        #[unsafe(method(name))]
98        #[unsafe(method_family = none)]
99        pub unsafe fn name(&self) -> Retained<NSString>;
100
101        #[unsafe(method(uniformType))]
102        #[unsafe(method_family = none)]
103        pub unsafe fn uniformType(&self) -> SKUniformType;
104
105        #[cfg(feature = "SKTexture")]
106        #[unsafe(method(textureValue))]
107        #[unsafe(method_family = none)]
108        pub unsafe fn textureValue(&self) -> Option<Retained<SKTexture>>;
109
110        #[cfg(feature = "SKTexture")]
111        /// Setter for [`textureValue`][Self::textureValue].
112        #[unsafe(method(setTextureValue:))]
113        #[unsafe(method_family = none)]
114        pub unsafe fn setTextureValue(&self, texture_value: Option<&SKTexture>);
115
116        #[unsafe(method(floatValue))]
117        #[unsafe(method_family = none)]
118        pub unsafe fn floatValue(&self) -> c_float;
119
120        /// Setter for [`floatValue`][Self::floatValue].
121        #[unsafe(method(setFloatValue:))]
122        #[unsafe(method_family = none)]
123        pub unsafe fn setFloatValue(&self, float_value: c_float);
124
125        #[unsafe(method(initWithName:))]
126        #[unsafe(method_family = init)]
127        pub unsafe fn initWithName(this: Allocated<Self>, name: &NSString) -> Retained<Self>;
128
129        #[cfg(feature = "SKTexture")]
130        #[unsafe(method(initWithName:texture:))]
131        #[unsafe(method_family = init)]
132        pub unsafe fn initWithName_texture(
133            this: Allocated<Self>,
134            name: &NSString,
135            texture: Option<&SKTexture>,
136        ) -> Retained<Self>;
137
138        #[unsafe(method(initWithName:float:))]
139        #[unsafe(method_family = init)]
140        pub unsafe fn initWithName_float(
141            this: Allocated<Self>,
142            name: &NSString,
143            value: c_float,
144        ) -> Retained<Self>;
145    );
146}
147
148/// Methods declared on superclass `NSObject`.
149impl SKUniform {
150    extern_methods!(
151        #[unsafe(method(init))]
152        #[unsafe(method_family = init)]
153        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
154
155        #[unsafe(method(new))]
156        #[unsafe(method_family = new)]
157        pub unsafe fn new() -> Retained<Self>;
158    );
159}