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:))]
239 #[unsafe(method_family = none)]
240 pub unsafe fn setCamera(&self, camera: Option<&SKCameraNode>);
241
242 #[unsafe(method(listener))]
246 #[unsafe(method_family = none)]
247 pub unsafe fn listener(&self) -> Option<Retained<SKNode>>;
248
249 #[unsafe(method(setListener:))]
253 #[unsafe(method_family = none)]
254 pub unsafe fn setListener(&self, listener: Option<&SKNode>);
255
256 #[cfg(feature = "objc2-avf-audio")]
257 #[unsafe(method(audioEngine))]
258 #[unsafe(method_family = none)]
259 pub unsafe fn audioEngine(&self) -> Retained<AVAudioEngine>;
260
261 #[unsafe(method(backgroundColor))]
263 #[unsafe(method_family = none)]
264 pub unsafe fn backgroundColor(&self) -> Retained<NSColor>;
265
266 #[unsafe(method(setBackgroundColor:))]
268 #[unsafe(method_family = none)]
269 pub unsafe fn setBackgroundColor(&self, background_color: &NSColor);
270
271 #[unsafe(method(delegate))]
272 #[unsafe(method_family = none)]
273 pub unsafe fn delegate(&self) -> Option<Retained<ProtocolObject<dyn SKSceneDelegate>>>;
274
275 #[unsafe(method(setDelegate:))]
279 #[unsafe(method_family = none)]
280 pub unsafe fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn SKSceneDelegate>>);
281
282 #[cfg(feature = "objc2-core-foundation")]
283 #[unsafe(method(anchorPoint))]
285 #[unsafe(method_family = none)]
286 pub unsafe fn anchorPoint(&self) -> CGPoint;
287
288 #[cfg(feature = "objc2-core-foundation")]
289 #[unsafe(method(setAnchorPoint:))]
291 #[unsafe(method_family = none)]
292 pub unsafe fn setAnchorPoint(&self, anchor_point: CGPoint);
293
294 #[cfg(feature = "SKPhysicsWorld")]
295 #[unsafe(method(physicsWorld))]
297 #[unsafe(method_family = none)]
298 pub unsafe fn physicsWorld(&self) -> Retained<SKPhysicsWorld>;
299
300 #[cfg(feature = "SKView")]
301 #[unsafe(method(view))]
303 #[unsafe(method_family = none)]
304 pub unsafe fn view(&self) -> Option<Retained<SKView>>;
305
306 #[cfg(feature = "objc2-core-foundation")]
307 #[unsafe(method(convertPointFromView:))]
308 #[unsafe(method_family = none)]
309 pub unsafe fn convertPointFromView(&self, point: CGPoint) -> CGPoint;
310
311 #[cfg(feature = "objc2-core-foundation")]
312 #[unsafe(method(convertPointToView:))]
313 #[unsafe(method_family = none)]
314 pub unsafe fn convertPointToView(&self, point: CGPoint) -> CGPoint;
315
316 #[unsafe(method(update:))]
321 #[unsafe(method_family = none)]
322 pub unsafe fn update(&self, current_time: NSTimeInterval);
323
324 #[unsafe(method(didEvaluateActions))]
326 #[unsafe(method_family = none)]
327 pub unsafe fn didEvaluateActions(&self);
328
329 #[unsafe(method(didSimulatePhysics))]
331 #[unsafe(method_family = none)]
332 pub unsafe fn didSimulatePhysics(&self);
333
334 #[unsafe(method(didApplyConstraints))]
336 #[unsafe(method_family = none)]
337 pub unsafe fn didApplyConstraints(&self);
338
339 #[unsafe(method(didFinishUpdate))]
343 #[unsafe(method_family = none)]
344 pub unsafe fn didFinishUpdate(&self);
345
346 #[cfg(feature = "SKView")]
347 #[unsafe(method(didMoveToView:))]
348 #[unsafe(method_family = none)]
349 pub unsafe fn didMoveToView(&self, view: &SKView);
350
351 #[cfg(feature = "SKView")]
352 #[unsafe(method(willMoveFromView:))]
353 #[unsafe(method_family = none)]
354 pub unsafe fn willMoveFromView(&self, view: &SKView);
355
356 #[cfg(feature = "objc2-core-foundation")]
357 #[unsafe(method(didChangeSize:))]
358 #[unsafe(method_family = none)]
359 pub unsafe fn didChangeSize(&self, old_size: CGSize);
360 );
361}
362
363#[cfg(all(
365 feature = "SKEffectNode",
366 feature = "SKNode",
367 feature = "objc2-app-kit"
368))]
369#[cfg(target_os = "macos")]
370impl SKScene {
371 extern_methods!(
372 #[unsafe(method(init))]
373 #[unsafe(method_family = init)]
374 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
375
376 #[unsafe(method(initWithCoder:))]
382 #[unsafe(method_family = init)]
383 pub unsafe fn initWithCoder(
384 this: Allocated<Self>,
385 a_decoder: &NSCoder,
386 ) -> Option<Retained<Self>>;
387
388 #[unsafe(method(node))]
389 #[unsafe(method_family = none)]
390 pub unsafe fn node(mtm: MainThreadMarker) -> Retained<Self>;
391
392 #[unsafe(method(nodeWithFileNamed:))]
393 #[unsafe(method_family = none)]
394 pub unsafe fn nodeWithFileNamed(
395 filename: &NSString,
396 mtm: MainThreadMarker,
397 ) -> Option<Retained<Self>>;
398
399 #[unsafe(method(nodeWithFileNamed:securelyWithClasses:andError:_))]
403 #[unsafe(method_family = none)]
404 pub unsafe fn nodeWithFileNamed_securelyWithClasses_andError(
405 filename: &NSString,
406 classes: &NSSet<AnyClass>,
407 mtm: MainThreadMarker,
408 ) -> Result<Retained<Self>, Retained<NSError>>;
409 );
410}
411
412#[cfg(all(
414 feature = "SKEffectNode",
415 feature = "SKNode",
416 feature = "objc2-app-kit"
417))]
418#[cfg(target_os = "macos")]
419impl SKScene {
420 extern_methods!(
421 #[unsafe(method(new))]
422 #[unsafe(method_family = new)]
423 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
424 );
425}