objc2_sprite_kit/generated/
SKLightNode.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::*;
6#[cfg(feature = "objc2-app-kit")]
7#[cfg(target_os = "macos")]
8use objc2_app_kit::*;
9#[cfg(feature = "objc2-core-foundation")]
10use objc2_core_foundation::*;
11use objc2_foundation::*;
12
13use crate::*;
14
15extern_class!(
16    /// [Apple's documentation](https://developer.apple.com/documentation/spritekit/sklightnode?language=objc)
17    #[unsafe(super(SKNode, NSResponder, NSObject))]
18    #[derive(Debug, PartialEq, Eq, Hash)]
19    #[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
20    #[cfg(target_os = "macos")]
21    pub struct SKLightNode;
22);
23
24#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
25#[cfg(target_os = "macos")]
26extern_conformance!(
27    unsafe impl NSCoding for SKLightNode {}
28);
29
30#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
31#[cfg(target_os = "macos")]
32extern_conformance!(
33    unsafe impl NSCopying for SKLightNode {}
34);
35
36#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
37#[cfg(target_os = "macos")]
38unsafe impl CopyingHelper for SKLightNode {
39    type Result = Self;
40}
41
42#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
43#[cfg(target_os = "macos")]
44extern_conformance!(
45    unsafe impl NSObjectProtocol for SKLightNode {}
46);
47
48#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
49#[cfg(target_os = "macos")]
50extern_conformance!(
51    unsafe impl NSSecureCoding for SKLightNode {}
52);
53
54#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
55#[cfg(target_os = "macos")]
56impl SKLightNode {
57    extern_methods!(
58        /// Enables or disables lighting contribution from this light node.
59        ///
60        /// Set to YES; sprites using this light will be lit with the ambient color and
61        /// the light color, with a falloff in intensity according to the falloff property.
62        ///
63        /// Set to NO; this light does not contribute any lighting.
64        ///
65        /// If no lights are active on a sprite it will be drawn normally, as if not lit.
66        ///
67        /// The default value is YES.
68        ///
69        ///
70        /// See: lightColor
71        ///
72        /// See: falloff
73        ///
74        /// See: categoryBitMask
75        #[unsafe(method(isEnabled))]
76        #[unsafe(method_family = none)]
77        pub unsafe fn isEnabled(&self) -> bool;
78
79        /// Setter for [`isEnabled`][Self::isEnabled].
80        #[unsafe(method(setEnabled:))]
81        #[unsafe(method_family = none)]
82        pub unsafe fn setEnabled(&self, enabled: bool);
83
84        /// Diffuse and Specular color of the light source, defaults to opaque white.
85        ///
86        /// The alpha component of the color is ignored.
87        ///
88        /// If using shaders bind a uniform to this property to use scene based custom lighting.
89        ///
90        ///
91        /// See: SKUniform
92        ///
93        /// See: falloff
94        #[unsafe(method(lightColor))]
95        #[unsafe(method_family = none)]
96        pub unsafe fn lightColor(&self) -> Retained<NSColor>;
97
98        /// Setter for [`lightColor`][Self::lightColor].
99        #[unsafe(method(setLightColor:))]
100        #[unsafe(method_family = none)]
101        pub unsafe fn setLightColor(&self, light_color: &NSColor);
102
103        /// Ambient color of the light source, defaults to black.
104        ///
105        /// If you had only a single light in the scene with an ambient color
106        /// of opaque white and a light color of black,
107        /// it would appear as if the scene was rendered without lighting.
108        ///
109        /// The alpha component of the color is ignored. The color is not
110        /// affected by falloff or surface normals.
111        ///
112        ///
113        /// See: lightColor
114        #[unsafe(method(ambientColor))]
115        #[unsafe(method_family = none)]
116        pub unsafe fn ambientColor(&self) -> Retained<NSColor>;
117
118        /// Setter for [`ambientColor`][Self::ambientColor].
119        #[unsafe(method(setAmbientColor:))]
120        #[unsafe(method_family = none)]
121        pub unsafe fn setAmbientColor(&self, ambient_color: &NSColor);
122
123        /// Color of the shadow casted on occluded objects, defaults to half opacity black.
124        ///
125        /// The alpha component of the color is used for blending with the regions that are in shadow.
126        ///
127        ///
128        /// See: SKSpriteNode.shadowCastBitMask
129        ///
130        /// See: SKSpriteNode.shadowedBitMask
131        #[unsafe(method(shadowColor))]
132        #[unsafe(method_family = none)]
133        pub unsafe fn shadowColor(&self) -> Retained<NSColor>;
134
135        /// Setter for [`shadowColor`][Self::shadowColor].
136        #[unsafe(method(setShadowColor:))]
137        #[unsafe(method_family = none)]
138        pub unsafe fn setShadowColor(&self, shadow_color: &NSColor);
139
140        #[cfg(feature = "objc2-core-foundation")]
141        /// Falloff in intensity of the light over distance, defaults to 1.
142        /// The falloff does not affect the ambient color nor the shadow color.
143        ///
144        ///
145        /// See: lightColor
146        #[unsafe(method(falloff))]
147        #[unsafe(method_family = none)]
148        pub unsafe fn falloff(&self) -> CGFloat;
149
150        #[cfg(feature = "objc2-core-foundation")]
151        /// Setter for [`falloff`][Self::falloff].
152        #[unsafe(method(setFalloff:))]
153        #[unsafe(method_family = none)]
154        pub unsafe fn setFalloff(&self, falloff: CGFloat);
155
156        /// The category of the light, which determines the group(s) a light belongs to.
157        /// Any node that has its corresponding light and shadow bitmasks set to an overlapping value
158        /// will be lit, shadow casting or shadowed by this light.
159        ///
160        ///
161        /// See: SKSpriteNode.lightingBitMask
162        ///
163        /// See: SKSpriteNode.shadowCastBitMask
164        ///
165        /// See: SKSpriteNode.shadowedBitMask
166        #[unsafe(method(categoryBitMask))]
167        #[unsafe(method_family = none)]
168        pub unsafe fn categoryBitMask(&self) -> u32;
169
170        /// Setter for [`categoryBitMask`][Self::categoryBitMask].
171        #[unsafe(method(setCategoryBitMask:))]
172        #[unsafe(method_family = none)]
173        pub unsafe fn setCategoryBitMask(&self, category_bit_mask: u32);
174    );
175}
176
177/// Methods declared on superclass `SKNode`.
178#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
179#[cfg(target_os = "macos")]
180impl SKLightNode {
181    extern_methods!(
182        #[unsafe(method(init))]
183        #[unsafe(method_family = init)]
184        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
185
186        /// Support coding and decoding via NSKeyedArchiver.
187        ///
188        /// # Safety
189        ///
190        /// `a_decoder` possibly has further requirements.
191        #[unsafe(method(initWithCoder:))]
192        #[unsafe(method_family = init)]
193        pub unsafe fn initWithCoder(
194            this: Allocated<Self>,
195            a_decoder: &NSCoder,
196        ) -> Option<Retained<Self>>;
197
198        #[unsafe(method(node))]
199        #[unsafe(method_family = none)]
200        pub unsafe fn node(mtm: MainThreadMarker) -> Retained<Self>;
201
202        #[unsafe(method(nodeWithFileNamed:))]
203        #[unsafe(method_family = none)]
204        pub unsafe fn nodeWithFileNamed(
205            filename: &NSString,
206            mtm: MainThreadMarker,
207        ) -> Option<Retained<Self>>;
208
209        /// # Safety
210        ///
211        /// `classes` generic probably has further requirements.
212        #[unsafe(method(nodeWithFileNamed:securelyWithClasses:andError:_))]
213        #[unsafe(method_family = none)]
214        pub unsafe fn nodeWithFileNamed_securelyWithClasses_andError(
215            filename: &NSString,
216            classes: &NSSet<AnyClass>,
217            mtm: MainThreadMarker,
218        ) -> Result<Retained<Self>, Retained<NSError>>;
219    );
220}
221
222/// Methods declared on superclass `NSObject`.
223#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
224#[cfg(target_os = "macos")]
225impl SKLightNode {
226    extern_methods!(
227        #[unsafe(method(new))]
228        #[unsafe(method_family = new)]
229        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
230    );
231}