objc2-sprite-kit 0.3.2

Bindings to the SpriteKit framework
Documentation
//! 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>;
    );
}