objc2_sprite_kit/generated/
SKSpriteNode.rs1use 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 #[unsafe(super(SKNode, NSResponder, NSObject))]
27 #[derive(Debug, PartialEq, Eq, Hash)]
28 #[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
29 #[cfg(target_os = "macos")]
30 pub struct SKSpriteNode;
31);
32
33#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
34#[cfg(target_os = "macos")]
35unsafe impl NSCoding for SKSpriteNode {}
36
37#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
38#[cfg(target_os = "macos")]
39unsafe impl NSCopying for SKSpriteNode {}
40
41#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
42#[cfg(target_os = "macos")]
43unsafe impl CopyingHelper for SKSpriteNode {
44 type Result = Self;
45}
46
47#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
48#[cfg(target_os = "macos")]
49unsafe impl NSObjectProtocol for SKSpriteNode {}
50
51#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
52#[cfg(target_os = "macos")]
53unsafe impl NSSecureCoding for SKSpriteNode {}
54
55#[cfg(all(
56 feature = "SKNode",
57 feature = "SKWarpGeometry",
58 feature = "objc2-app-kit"
59))]
60#[cfg(target_os = "macos")]
61unsafe impl SKWarpable for SKSpriteNode {}
62
63#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
64#[cfg(target_os = "macos")]
65impl SKSpriteNode {
66 extern_methods!(
67 #[cfg(all(feature = "SKTexture", feature = "objc2-core-foundation"))]
68 #[unsafe(method(spriteNodeWithTexture:size:))]
74 #[unsafe(method_family = none)]
75 pub unsafe fn spriteNodeWithTexture_size(
76 texture: Option<&SKTexture>,
77 size: CGSize,
78 mtm: MainThreadMarker,
79 ) -> Retained<Self>;
80
81 #[cfg(feature = "SKTexture")]
82 #[unsafe(method(spriteNodeWithTexture:))]
86 #[unsafe(method_family = none)]
87 pub unsafe fn spriteNodeWithTexture(
88 texture: Option<&SKTexture>,
89 mtm: MainThreadMarker,
90 ) -> Retained<Self>;
91
92 #[cfg(feature = "SKTexture")]
93 #[unsafe(method(spriteNodeWithTexture:normalMap:))]
94 #[unsafe(method_family = none)]
95 pub unsafe fn spriteNodeWithTexture_normalMap(
96 texture: Option<&SKTexture>,
97 normal_map: Option<&SKTexture>,
98 mtm: MainThreadMarker,
99 ) -> Retained<Self>;
100
101 #[unsafe(method(spriteNodeWithImageNamed:))]
107 #[unsafe(method_family = none)]
108 pub unsafe fn spriteNodeWithImageNamed(
109 name: &NSString,
110 mtm: MainThreadMarker,
111 ) -> Retained<Self>;
112
113 #[unsafe(method(spriteNodeWithImageNamed:normalMapped:))]
114 #[unsafe(method_family = none)]
115 pub unsafe fn spriteNodeWithImageNamed_normalMapped(
116 name: &NSString,
117 generate_normal_map: bool,
118 mtm: MainThreadMarker,
119 ) -> Retained<Self>;
120
121 #[cfg(feature = "objc2-core-foundation")]
122 #[unsafe(method(spriteNodeWithColor:size:))]
128 #[unsafe(method_family = none)]
129 pub unsafe fn spriteNodeWithColor_size(
130 color: &NSColor,
131 size: CGSize,
132 mtm: MainThreadMarker,
133 ) -> Retained<Self>;
134
135 #[cfg(all(feature = "SKTexture", feature = "objc2-core-foundation"))]
136 #[unsafe(method(initWithTexture:color:size:))]
145 #[unsafe(method_family = init)]
146 pub unsafe fn initWithTexture_color_size(
147 this: Allocated<Self>,
148 texture: Option<&SKTexture>,
149 color: &NSColor,
150 size: CGSize,
151 ) -> Retained<Self>;
152
153 #[cfg(feature = "SKTexture")]
154 #[unsafe(method(initWithTexture:))]
158 #[unsafe(method_family = init)]
159 pub unsafe fn initWithTexture(
160 this: Allocated<Self>,
161 texture: Option<&SKTexture>,
162 ) -> Retained<Self>;
163
164 #[unsafe(method(initWithImageNamed:))]
170 #[unsafe(method_family = init)]
171 pub unsafe fn initWithImageNamed(this: Allocated<Self>, name: &NSString) -> Retained<Self>;
172
173 #[cfg(feature = "objc2-core-foundation")]
174 #[unsafe(method(initWithColor:size:))]
180 #[unsafe(method_family = init)]
181 pub unsafe fn initWithColor_size(
182 this: Allocated<Self>,
183 color: &NSColor,
184 size: CGSize,
185 ) -> Retained<Self>;
186
187 #[unsafe(method(initWithCoder:))]
189 #[unsafe(method_family = init)]
190 pub unsafe fn initWithCoder(
191 this: Allocated<Self>,
192 a_decoder: &NSCoder,
193 ) -> Option<Retained<Self>>;
194
195 #[cfg(feature = "SKTexture")]
196 #[unsafe(method(texture))]
198 #[unsafe(method_family = none)]
199 pub unsafe fn texture(&self) -> Option<Retained<SKTexture>>;
200
201 #[cfg(feature = "SKTexture")]
202 #[unsafe(method(setTexture:))]
204 #[unsafe(method_family = none)]
205 pub unsafe fn setTexture(&self, texture: Option<&SKTexture>);
206
207 #[cfg(feature = "SKTexture")]
208 #[unsafe(method(normalTexture))]
217 #[unsafe(method_family = none)]
218 pub unsafe fn normalTexture(&self) -> Option<Retained<SKTexture>>;
219
220 #[cfg(feature = "SKTexture")]
221 #[unsafe(method(setNormalTexture:))]
223 #[unsafe(method_family = none)]
224 pub unsafe fn setNormalTexture(&self, normal_texture: Option<&SKTexture>);
225
226 #[unsafe(method(lightingBitMask))]
233 #[unsafe(method_family = none)]
234 pub unsafe fn lightingBitMask(&self) -> u32;
235
236 #[unsafe(method(setLightingBitMask:))]
238 #[unsafe(method_family = none)]
239 pub unsafe fn setLightingBitMask(&self, lighting_bit_mask: u32);
240
241 #[unsafe(method(shadowCastBitMask))]
242 #[unsafe(method_family = none)]
243 pub unsafe fn shadowCastBitMask(&self) -> u32;
244
245 #[unsafe(method(setShadowCastBitMask:))]
247 #[unsafe(method_family = none)]
248 pub unsafe fn setShadowCastBitMask(&self, shadow_cast_bit_mask: u32);
249
250 #[unsafe(method(shadowedBitMask))]
251 #[unsafe(method_family = none)]
252 pub unsafe fn shadowedBitMask(&self) -> u32;
253
254 #[unsafe(method(setShadowedBitMask:))]
256 #[unsafe(method_family = none)]
257 pub unsafe fn setShadowedBitMask(&self, shadowed_bit_mask: u32);
258
259 #[cfg(feature = "objc2-core-foundation")]
260 #[unsafe(method(centerRect))]
264 #[unsafe(method_family = none)]
265 pub unsafe fn centerRect(&self) -> CGRect;
266
267 #[cfg(feature = "objc2-core-foundation")]
268 #[unsafe(method(setCenterRect:))]
270 #[unsafe(method_family = none)]
271 pub unsafe fn setCenterRect(&self, center_rect: CGRect);
272
273 #[cfg(feature = "objc2-core-foundation")]
274 #[unsafe(method(colorBlendFactor))]
276 #[unsafe(method_family = none)]
277 pub unsafe fn colorBlendFactor(&self) -> CGFloat;
278
279 #[cfg(feature = "objc2-core-foundation")]
280 #[unsafe(method(setColorBlendFactor:))]
282 #[unsafe(method_family = none)]
283 pub unsafe fn setColorBlendFactor(&self, color_blend_factor: CGFloat);
284
285 #[unsafe(method(color))]
287 #[unsafe(method_family = none)]
288 pub unsafe fn color(&self) -> Retained<NSColor>;
289
290 #[unsafe(method(setColor:))]
292 #[unsafe(method_family = none)]
293 pub unsafe fn setColor(&self, color: &NSColor);
294
295 #[unsafe(method(blendMode))]
299 #[unsafe(method_family = none)]
300 pub unsafe fn blendMode(&self) -> SKBlendMode;
301
302 #[unsafe(method(setBlendMode:))]
304 #[unsafe(method_family = none)]
305 pub unsafe fn setBlendMode(&self, blend_mode: SKBlendMode);
306
307 #[cfg(feature = "objc2-core-foundation")]
308 #[unsafe(method(anchorPoint))]
310 #[unsafe(method_family = none)]
311 pub unsafe fn anchorPoint(&self) -> CGPoint;
312
313 #[cfg(feature = "objc2-core-foundation")]
314 #[unsafe(method(setAnchorPoint:))]
316 #[unsafe(method_family = none)]
317 pub unsafe fn setAnchorPoint(&self, anchor_point: CGPoint);
318
319 #[cfg(feature = "objc2-core-foundation")]
320 #[unsafe(method(size))]
322 #[unsafe(method_family = none)]
323 pub unsafe fn size(&self) -> CGSize;
324
325 #[cfg(feature = "objc2-core-foundation")]
326 #[unsafe(method(setSize:))]
328 #[unsafe(method_family = none)]
329 pub unsafe fn setSize(&self, size: CGSize);
330
331 #[cfg(feature = "objc2-core-foundation")]
332 #[unsafe(method(scaleToSize:))]
336 #[unsafe(method_family = none)]
337 pub unsafe fn scaleToSize(&self, size: CGSize);
338
339 #[cfg(feature = "SKShader")]
340 #[unsafe(method(shader))]
341 #[unsafe(method_family = none)]
342 pub unsafe fn shader(&self) -> Option<Retained<SKShader>>;
343
344 #[cfg(feature = "SKShader")]
345 #[unsafe(method(setShader:))]
347 #[unsafe(method_family = none)]
348 pub unsafe fn setShader(&self, shader: Option<&SKShader>);
349
350 #[cfg(feature = "SKAttribute")]
351 #[unsafe(method(attributeValues))]
354 #[unsafe(method_family = none)]
355 pub unsafe fn attributeValues(&self) -> Retained<NSDictionary<NSString, SKAttributeValue>>;
356
357 #[cfg(feature = "SKAttribute")]
358 #[unsafe(method(setAttributeValues:))]
360 #[unsafe(method_family = none)]
361 pub unsafe fn setAttributeValues(
362 &self,
363 attribute_values: &NSDictionary<NSString, SKAttributeValue>,
364 );
365
366 #[cfg(feature = "SKAttribute")]
367 #[unsafe(method(valueForAttributeNamed:))]
368 #[unsafe(method_family = none)]
369 pub unsafe fn valueForAttributeNamed(
370 &self,
371 key: &NSString,
372 ) -> Option<Retained<SKAttributeValue>>;
373
374 #[cfg(feature = "SKAttribute")]
375 #[unsafe(method(setValue:forAttributeNamed:))]
376 #[unsafe(method_family = none)]
377 pub unsafe fn setValue_forAttributeNamed(&self, value: &SKAttributeValue, key: &NSString);
378 );
379}
380
381#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
383#[cfg(target_os = "macos")]
384impl SKSpriteNode {
385 extern_methods!(
386 #[unsafe(method(init))]
387 #[unsafe(method_family = init)]
388 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
389
390 #[unsafe(method(node))]
391 #[unsafe(method_family = none)]
392 pub unsafe fn node(mtm: MainThreadMarker) -> Retained<Self>;
393
394 #[unsafe(method(nodeWithFileNamed:))]
395 #[unsafe(method_family = none)]
396 pub unsafe fn nodeWithFileNamed(
397 filename: &NSString,
398 mtm: MainThreadMarker,
399 ) -> Option<Retained<Self>>;
400
401 #[unsafe(method(nodeWithFileNamed:securelyWithClasses:andError:_))]
402 #[unsafe(method_family = none)]
403 pub unsafe fn nodeWithFileNamed_securelyWithClasses_andError(
404 filename: &NSString,
405 classes: &NSSet<AnyClass>,
406 mtm: MainThreadMarker,
407 ) -> Result<Retained<Self>, Retained<NSError>>;
408 );
409}
410
411#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
413#[cfg(target_os = "macos")]
414impl SKSpriteNode {
415 extern_methods!(
416 #[unsafe(method(new))]
417 #[unsafe(method_family = new)]
418 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
419 );
420}