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