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