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