objc2_sprite_kit/generated/
SKScene.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-avf-audio")]
10use objc2_avf_audio::*;
11#[cfg(feature = "objc2-core-foundation")]
12use objc2_core_foundation::*;
13use objc2_foundation::*;
14
15use crate::*;
16
17#[repr(transparent)]
20#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
21pub struct SKSceneScaleMode(pub NSInteger);
22impl SKSceneScaleMode {
23 #[doc(alias = "SKSceneScaleModeFill")]
24 pub const Fill: Self = Self(0);
25 #[doc(alias = "SKSceneScaleModeAspectFill")]
26 pub const AspectFill: Self = Self(1);
27 #[doc(alias = "SKSceneScaleModeAspectFit")]
28 pub const AspectFit: Self = Self(2);
29 #[doc(alias = "SKSceneScaleModeResizeFill")]
30 pub const ResizeFill: Self = Self(3);
31}
32
33unsafe impl Encode for SKSceneScaleMode {
34 const ENCODING: Encoding = NSInteger::ENCODING;
35}
36
37unsafe impl RefEncode for SKSceneScaleMode {
38 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
39}
40
41extern_protocol!(
42 pub unsafe trait SKSceneDelegate: NSObjectProtocol {
44 #[cfg(all(
45 feature = "SKEffectNode",
46 feature = "SKNode",
47 feature = "objc2-app-kit"
48 ))]
49 #[cfg(target_os = "macos")]
50 #[optional]
51 #[unsafe(method(update:forScene:))]
52 #[unsafe(method_family = none)]
53 unsafe fn update_forScene(&self, current_time: NSTimeInterval, scene: &SKScene);
54
55 #[cfg(all(
56 feature = "SKEffectNode",
57 feature = "SKNode",
58 feature = "objc2-app-kit"
59 ))]
60 #[cfg(target_os = "macos")]
61 #[optional]
62 #[unsafe(method(didEvaluateActionsForScene:))]
63 #[unsafe(method_family = none)]
64 unsafe fn didEvaluateActionsForScene(&self, scene: &SKScene);
65
66 #[cfg(all(
67 feature = "SKEffectNode",
68 feature = "SKNode",
69 feature = "objc2-app-kit"
70 ))]
71 #[cfg(target_os = "macos")]
72 #[optional]
73 #[unsafe(method(didSimulatePhysicsForScene:))]
74 #[unsafe(method_family = none)]
75 unsafe fn didSimulatePhysicsForScene(&self, scene: &SKScene);
76
77 #[cfg(all(
78 feature = "SKEffectNode",
79 feature = "SKNode",
80 feature = "objc2-app-kit"
81 ))]
82 #[cfg(target_os = "macos")]
83 #[optional]
84 #[unsafe(method(didApplyConstraintsForScene:))]
85 #[unsafe(method_family = none)]
86 unsafe fn didApplyConstraintsForScene(&self, scene: &SKScene);
87
88 #[cfg(all(
89 feature = "SKEffectNode",
90 feature = "SKNode",
91 feature = "objc2-app-kit"
92 ))]
93 #[cfg(target_os = "macos")]
94 #[optional]
95 #[unsafe(method(didFinishUpdateForScene:))]
96 #[unsafe(method_family = none)]
97 unsafe fn didFinishUpdateForScene(&self, scene: &SKScene);
98 }
99);
100
101extern_class!(
102 #[unsafe(super(SKEffectNode, SKNode, NSResponder, NSObject))]
109 #[derive(Debug, PartialEq, Eq, Hash)]
110 #[cfg(all(
111 feature = "SKEffectNode",
112 feature = "SKNode",
113 feature = "objc2-app-kit"
114 ))]
115 #[cfg(target_os = "macos")]
116 pub struct SKScene;
117);
118
119#[cfg(all(
120 feature = "SKEffectNode",
121 feature = "SKNode",
122 feature = "objc2-app-kit"
123))]
124#[cfg(target_os = "macos")]
125extern_conformance!(
126 unsafe impl NSCoding for SKScene {}
127);
128
129#[cfg(all(
130 feature = "SKEffectNode",
131 feature = "SKNode",
132 feature = "objc2-app-kit"
133))]
134#[cfg(target_os = "macos")]
135extern_conformance!(
136 unsafe impl NSCopying for SKScene {}
137);
138
139#[cfg(all(
140 feature = "SKEffectNode",
141 feature = "SKNode",
142 feature = "objc2-app-kit"
143))]
144#[cfg(target_os = "macos")]
145unsafe impl CopyingHelper for SKScene {
146 type Result = Self;
147}
148
149#[cfg(all(
150 feature = "SKEffectNode",
151 feature = "SKNode",
152 feature = "objc2-app-kit"
153))]
154#[cfg(target_os = "macos")]
155extern_conformance!(
156 unsafe impl NSObjectProtocol for SKScene {}
157);
158
159#[cfg(all(
160 feature = "SKEffectNode",
161 feature = "SKNode",
162 feature = "objc2-app-kit"
163))]
164#[cfg(target_os = "macos")]
165extern_conformance!(
166 unsafe impl NSSecureCoding for SKScene {}
167);
168
169#[cfg(all(
170 feature = "SKEffectNode",
171 feature = "SKNode",
172 feature = "SKWarpGeometry",
173 feature = "objc2-app-kit"
174))]
175#[cfg(target_os = "macos")]
176extern_conformance!(
177 unsafe impl SKWarpable for SKScene {}
178);
179
180#[cfg(all(
181 feature = "SKEffectNode",
182 feature = "SKNode",
183 feature = "objc2-app-kit"
184))]
185#[cfg(target_os = "macos")]
186impl SKScene {
187 extern_methods!(
188 #[cfg(feature = "objc2-core-foundation")]
189 #[unsafe(method(initWithSize:))]
195 #[unsafe(method_family = init)]
196 pub unsafe fn initWithSize(this: Allocated<Self>, size: CGSize) -> Retained<Self>;
197
198 #[cfg(feature = "objc2-core-foundation")]
199 #[unsafe(method(sceneWithSize:))]
200 #[unsafe(method_family = none)]
201 pub unsafe fn sceneWithSize(size: CGSize, mtm: MainThreadMarker) -> Retained<Self>;
202
203 #[unsafe(method(sceneDidLoad))]
204 #[unsafe(method_family = none)]
205 pub unsafe fn sceneDidLoad(&self);
206
207 #[cfg(feature = "objc2-core-foundation")]
208 #[unsafe(method(size))]
209 #[unsafe(method_family = none)]
210 pub unsafe fn size(&self) -> CGSize;
211
212 #[cfg(feature = "objc2-core-foundation")]
213 #[unsafe(method(setSize:))]
215 #[unsafe(method_family = none)]
216 pub unsafe fn setSize(&self, size: CGSize);
217
218 #[unsafe(method(scaleMode))]
220 #[unsafe(method_family = none)]
221 pub unsafe fn scaleMode(&self) -> SKSceneScaleMode;
222
223 #[unsafe(method(setScaleMode:))]
225 #[unsafe(method_family = none)]
226 pub unsafe fn setScaleMode(&self, scale_mode: SKSceneScaleMode);
227
228 #[cfg(feature = "SKCameraNode")]
229 #[unsafe(method(camera))]
231 #[unsafe(method_family = none)]
232 pub unsafe fn camera(&self) -> Option<Retained<SKCameraNode>>;
233
234 #[cfg(feature = "SKCameraNode")]
235 #[unsafe(method(setCamera:))]
238 #[unsafe(method_family = none)]
239 pub unsafe fn setCamera(&self, camera: Option<&SKCameraNode>);
240
241 #[unsafe(method(listener))]
245 #[unsafe(method_family = none)]
246 pub unsafe fn listener(&self) -> Option<Retained<SKNode>>;
247
248 #[unsafe(method(setListener:))]
251 #[unsafe(method_family = none)]
252 pub unsafe fn setListener(&self, listener: Option<&SKNode>);
253
254 #[cfg(feature = "objc2-avf-audio")]
255 #[unsafe(method(audioEngine))]
256 #[unsafe(method_family = none)]
257 pub unsafe fn audioEngine(&self) -> Retained<AVAudioEngine>;
258
259 #[unsafe(method(backgroundColor))]
261 #[unsafe(method_family = none)]
262 pub unsafe fn backgroundColor(&self) -> Retained<NSColor>;
263
264 #[unsafe(method(setBackgroundColor:))]
266 #[unsafe(method_family = none)]
267 pub unsafe fn setBackgroundColor(&self, background_color: &NSColor);
268
269 #[unsafe(method(delegate))]
270 #[unsafe(method_family = none)]
271 pub unsafe fn delegate(&self) -> Option<Retained<ProtocolObject<dyn SKSceneDelegate>>>;
272
273 #[unsafe(method(setDelegate:))]
276 #[unsafe(method_family = none)]
277 pub unsafe fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn SKSceneDelegate>>);
278
279 #[cfg(feature = "objc2-core-foundation")]
280 #[unsafe(method(anchorPoint))]
282 #[unsafe(method_family = none)]
283 pub unsafe fn anchorPoint(&self) -> CGPoint;
284
285 #[cfg(feature = "objc2-core-foundation")]
286 #[unsafe(method(setAnchorPoint:))]
288 #[unsafe(method_family = none)]
289 pub unsafe fn setAnchorPoint(&self, anchor_point: CGPoint);
290
291 #[cfg(feature = "SKPhysicsWorld")]
292 #[unsafe(method(physicsWorld))]
294 #[unsafe(method_family = none)]
295 pub unsafe fn physicsWorld(&self) -> Retained<SKPhysicsWorld>;
296
297 #[cfg(feature = "SKView")]
298 #[unsafe(method(view))]
300 #[unsafe(method_family = none)]
301 pub unsafe fn view(&self) -> Option<Retained<SKView>>;
302
303 #[cfg(feature = "objc2-core-foundation")]
304 #[unsafe(method(convertPointFromView:))]
305 #[unsafe(method_family = none)]
306 pub unsafe fn convertPointFromView(&self, point: CGPoint) -> CGPoint;
307
308 #[cfg(feature = "objc2-core-foundation")]
309 #[unsafe(method(convertPointToView:))]
310 #[unsafe(method_family = none)]
311 pub unsafe fn convertPointToView(&self, point: CGPoint) -> CGPoint;
312
313 #[unsafe(method(update:))]
318 #[unsafe(method_family = none)]
319 pub unsafe fn update(&self, current_time: NSTimeInterval);
320
321 #[unsafe(method(didEvaluateActions))]
323 #[unsafe(method_family = none)]
324 pub unsafe fn didEvaluateActions(&self);
325
326 #[unsafe(method(didSimulatePhysics))]
328 #[unsafe(method_family = none)]
329 pub unsafe fn didSimulatePhysics(&self);
330
331 #[unsafe(method(didApplyConstraints))]
333 #[unsafe(method_family = none)]
334 pub unsafe fn didApplyConstraints(&self);
335
336 #[unsafe(method(didFinishUpdate))]
340 #[unsafe(method_family = none)]
341 pub unsafe fn didFinishUpdate(&self);
342
343 #[cfg(feature = "SKView")]
344 #[unsafe(method(didMoveToView:))]
345 #[unsafe(method_family = none)]
346 pub unsafe fn didMoveToView(&self, view: &SKView);
347
348 #[cfg(feature = "SKView")]
349 #[unsafe(method(willMoveFromView:))]
350 #[unsafe(method_family = none)]
351 pub unsafe fn willMoveFromView(&self, view: &SKView);
352
353 #[cfg(feature = "objc2-core-foundation")]
354 #[unsafe(method(didChangeSize:))]
355 #[unsafe(method_family = none)]
356 pub unsafe fn didChangeSize(&self, old_size: CGSize);
357 );
358}
359
360#[cfg(all(
362 feature = "SKEffectNode",
363 feature = "SKNode",
364 feature = "objc2-app-kit"
365))]
366#[cfg(target_os = "macos")]
367impl SKScene {
368 extern_methods!(
369 #[unsafe(method(init))]
370 #[unsafe(method_family = init)]
371 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
372
373 #[unsafe(method(initWithCoder:))]
375 #[unsafe(method_family = init)]
376 pub unsafe fn initWithCoder(
377 this: Allocated<Self>,
378 a_decoder: &NSCoder,
379 ) -> Option<Retained<Self>>;
380
381 #[unsafe(method(node))]
382 #[unsafe(method_family = none)]
383 pub unsafe fn node(mtm: MainThreadMarker) -> Retained<Self>;
384
385 #[unsafe(method(nodeWithFileNamed:))]
386 #[unsafe(method_family = none)]
387 pub unsafe fn nodeWithFileNamed(
388 filename: &NSString,
389 mtm: MainThreadMarker,
390 ) -> Option<Retained<Self>>;
391
392 #[unsafe(method(nodeWithFileNamed:securelyWithClasses:andError:_))]
393 #[unsafe(method_family = none)]
394 pub unsafe fn nodeWithFileNamed_securelyWithClasses_andError(
395 filename: &NSString,
396 classes: &NSSet<AnyClass>,
397 mtm: MainThreadMarker,
398 ) -> Result<Retained<Self>, Retained<NSError>>;
399 );
400}
401
402#[cfg(all(
404 feature = "SKEffectNode",
405 feature = "SKNode",
406 feature = "objc2-app-kit"
407))]
408#[cfg(target_os = "macos")]
409impl SKScene {
410 extern_methods!(
411 #[unsafe(method(new))]
412 #[unsafe(method_family = new)]
413 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
414 );
415}