1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
use objc2_foundation::*;
#[cfg(feature = "objc2-metal")]
#[cfg(not(target_os = "watchos"))]
use objc2_metal::*;
use crate::*;
extern_class!(
/// A renderer for displaying a SpriteKit scene in an existing Metal workflow.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/spritekit/skrenderer?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct SKRenderer;
);
extern_conformance!(
unsafe impl NSObjectProtocol for SKRenderer {}
);
impl SKRenderer {
extern_methods!(
#[cfg(feature = "objc2-metal")]
#[cfg(not(target_os = "watchos"))]
/// Creates a renderer with the specified Metal device.
///
///
/// Parameter `device`: A Metal device.
///
/// Returns: A new renderer object.
#[unsafe(method(rendererWithDevice:))]
#[unsafe(method_family = none)]
pub unsafe fn rendererWithDevice(
device: &ProtocolObject<dyn MTLDevice>,
) -> Retained<SKRenderer>;
#[cfg(all(feature = "objc2-core-foundation", feature = "objc2-metal"))]
#[cfg(not(target_os = "watchos"))]
/// Render the scene content in the specified Metal command buffer.
///
///
/// Parameter `viewport`: The pixel dimensions in which to render.
///
/// Parameter `commandBuffer`: The Metal command buffer in which SpriteKit should schedule rendering commands.
///
/// Parameter `renderPassDescriptor`: The Metal render pass descriptor describing the rendering target.
#[unsafe(method(renderWithViewport:commandBuffer:renderPassDescriptor:))]
#[unsafe(method_family = none)]
pub unsafe fn renderWithViewport_commandBuffer_renderPassDescriptor(
&self,
viewport: CGRect,
command_buffer: &ProtocolObject<dyn MTLCommandBuffer>,
render_pass_descriptor: &MTLRenderPassDescriptor,
);
#[cfg(all(feature = "objc2-core-foundation", feature = "objc2-metal"))]
#[cfg(not(target_os = "watchos"))]
/// Render the scene content using a specific Metal command encoder.
///
///
/// Parameter `viewport`: The pixel dimensions in which to render.
///
/// Parameter `renderCommandEncoder`: The Metal render command encoder that SpriteKit will use to encode rendering commands. This method will not call endEncoding.
///
/// Parameter `renderPassDescriptor`: The Metal render pass descriptor describing the rendering target.
///
/// Parameter `commandQueue`: The Metal command queue.
#[unsafe(method(renderWithViewport:renderCommandEncoder:renderPassDescriptor:commandQueue:))]
#[unsafe(method_family = none)]
pub unsafe fn renderWithViewport_renderCommandEncoder_renderPassDescriptor_commandQueue(
&self,
viewport: CGRect,
render_command_encoder: &ProtocolObject<dyn MTLRenderCommandEncoder>,
render_pass_descriptor: &MTLRenderPassDescriptor,
command_queue: &ProtocolObject<dyn MTLCommandQueue>,
);
/// Update the scene at the specified system time.
///
///
/// Parameter `currentTime`: The timestamp in seconds.
#[unsafe(method(updateAtTime:))]
#[unsafe(method_family = none)]
pub unsafe fn updateAtTime(&self, current_time: NSTimeInterval);
#[cfg(all(
feature = "SKEffectNode",
feature = "SKNode",
feature = "SKScene",
feature = "objc2-app-kit"
))]
#[cfg(target_os = "macos")]
/// The currently presented scene, otherwise nil. If in a transition, the 'incoming' scene is returned.
#[unsafe(method(scene))]
#[unsafe(method_family = none)]
pub unsafe fn scene(&self, mtm: MainThreadMarker) -> Option<Retained<SKScene>>;
#[cfg(all(
feature = "SKEffectNode",
feature = "SKNode",
feature = "SKScene",
feature = "objc2-app-kit"
))]
#[cfg(target_os = "macos")]
/// Setter for [`scene`][Self::scene].
#[unsafe(method(setScene:))]
#[unsafe(method_family = none)]
pub unsafe fn setScene(&self, scene: Option<&SKScene>);
/// Ignores sibling and traversal order to sort the rendered contents of a scene into the most efficient batching possible.
/// This will require zPosition to be used in the scenes to properly guarantee elements are in front or behind each other.
///
/// This defaults to NO, meaning that sibling order overrides efficiency heuristics in the rendering of the scenes in the view.
///
/// Setting this to YES for a complex scene may substantially increase performance, but care must be taken as only zPosition
/// determines render order before the efficiency heuristics are used.
#[unsafe(method(ignoresSiblingOrder))]
#[unsafe(method_family = none)]
pub unsafe fn ignoresSiblingOrder(&self) -> bool;
/// Setter for [`ignoresSiblingOrder`][Self::ignoresSiblingOrder].
#[unsafe(method(setIgnoresSiblingOrder:))]
#[unsafe(method_family = none)]
pub unsafe fn setIgnoresSiblingOrder(&self, ignores_sibling_order: bool);
/// A boolean that indicated whether non-visible nodes should be automatically culled when rendering.
#[unsafe(method(shouldCullNonVisibleNodes))]
#[unsafe(method_family = none)]
pub unsafe fn shouldCullNonVisibleNodes(&self) -> bool;
/// Setter for [`shouldCullNonVisibleNodes`][Self::shouldCullNonVisibleNodes].
#[unsafe(method(setShouldCullNonVisibleNodes:))]
#[unsafe(method_family = none)]
pub unsafe fn setShouldCullNonVisibleNodes(&self, should_cull_non_visible_nodes: bool);
/// Toggles display of performance stats when rendering. All default to false.
#[unsafe(method(showsDrawCount))]
#[unsafe(method_family = none)]
pub unsafe fn showsDrawCount(&self) -> bool;
/// Setter for [`showsDrawCount`][Self::showsDrawCount].
#[unsafe(method(setShowsDrawCount:))]
#[unsafe(method_family = none)]
pub unsafe fn setShowsDrawCount(&self, shows_draw_count: bool);
#[unsafe(method(showsNodeCount))]
#[unsafe(method_family = none)]
pub unsafe fn showsNodeCount(&self) -> bool;
/// Setter for [`showsNodeCount`][Self::showsNodeCount].
#[unsafe(method(setShowsNodeCount:))]
#[unsafe(method_family = none)]
pub unsafe fn setShowsNodeCount(&self, shows_node_count: bool);
#[unsafe(method(showsQuadCount))]
#[unsafe(method_family = none)]
pub unsafe fn showsQuadCount(&self) -> bool;
/// Setter for [`showsQuadCount`][Self::showsQuadCount].
#[unsafe(method(setShowsQuadCount:))]
#[unsafe(method_family = none)]
pub unsafe fn setShowsQuadCount(&self, shows_quad_count: bool);
#[unsafe(method(showsPhysics))]
#[unsafe(method_family = none)]
pub unsafe fn showsPhysics(&self) -> bool;
/// Setter for [`showsPhysics`][Self::showsPhysics].
#[unsafe(method(setShowsPhysics:))]
#[unsafe(method_family = none)]
pub unsafe fn setShowsPhysics(&self, shows_physics: bool);
#[unsafe(method(showsFields))]
#[unsafe(method_family = none)]
pub unsafe fn showsFields(&self) -> bool;
/// Setter for [`showsFields`][Self::showsFields].
#[unsafe(method(setShowsFields:))]
#[unsafe(method_family = none)]
pub unsafe fn setShowsFields(&self, shows_fields: bool);
);
}
/// Methods declared on superclass `NSObject`.
impl SKRenderer {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}