objc2_sprite_kit/generated/
SKCameraNode.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5#[cfg(feature = "objc2-app-kit")]
6#[cfg(target_os = "macos")]
7use objc2_app_kit::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12extern_class!(
13    /// A Camera node is a full fledged SKNode that can have actions and physics applied to it.
14    /// It also uses the standard SKNode transform system so modifying the camera node's position
15    /// is how you translate the camera's viewport. Applying a scale to the node would zoom
16    /// the viewport in or out etc. As an added benefit you can now rotate the viewport by
17    /// applying a zRotation to the camera node, just as you would with any other SKNode.
18    ///
19    /// The camera viewport is centered on the camera's position. It uses the scene's frame
20    /// and scale mode along with the node transforms to determine the size, origin and
21    /// rotation of the viewport.
22    ///
23    /// There are some convenience functions included for testing if nodes are contained
24    /// within the camera viewport. It can be used to determine if objects are no longer
25    /// visible on the display.
26    ///
27    /// In order to use a camera; set it on the scene that contains the camera.
28    ///
29    /// See: SKScene.camera
30    ///
31    /// See also [Apple's documentation](https://developer.apple.com/documentation/spritekit/skcameranode?language=objc)
32    #[unsafe(super(SKNode, NSResponder, NSObject))]
33    #[derive(Debug, PartialEq, Eq, Hash)]
34    #[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
35    #[cfg(target_os = "macos")]
36    pub struct SKCameraNode;
37);
38
39#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
40#[cfg(target_os = "macos")]
41extern_conformance!(
42    unsafe impl NSCoding for SKCameraNode {}
43);
44
45#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
46#[cfg(target_os = "macos")]
47extern_conformance!(
48    unsafe impl NSCopying for SKCameraNode {}
49);
50
51#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
52#[cfg(target_os = "macos")]
53unsafe impl CopyingHelper for SKCameraNode {
54    type Result = Self;
55}
56
57#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
58#[cfg(target_os = "macos")]
59extern_conformance!(
60    unsafe impl NSObjectProtocol for SKCameraNode {}
61);
62
63#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
64#[cfg(target_os = "macos")]
65extern_conformance!(
66    unsafe impl NSSecureCoding for SKCameraNode {}
67);
68
69#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
70#[cfg(target_os = "macos")]
71impl SKCameraNode {
72    extern_methods!(
73        /// Checks if the node is contained inside the viewport of the camera.
74        /// The camera and node must both be in the same scene and presented on a view in order
75        /// to determine if the node is inside the camera viewport rectangle.
76        ///
77        ///
78        /// Returns: YES if the node is inside the viewport. NO if node is nil or the node is outside the viewport.
79        #[unsafe(method(containsNode:))]
80        #[unsafe(method_family = none)]
81        pub unsafe fn containsNode(&self, node: &SKNode) -> bool;
82
83        /// Returns the set of nodes in the same scene as the camera that are contained within its viewport.
84        ///
85        /// Returns: the set of nodes contained
86        #[unsafe(method(containedNodeSet))]
87        #[unsafe(method_family = none)]
88        pub unsafe fn containedNodeSet(&self) -> Retained<NSSet<SKNode>>;
89    );
90}
91
92/// Methods declared on superclass `SKNode`.
93#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
94#[cfg(target_os = "macos")]
95impl SKCameraNode {
96    extern_methods!(
97        #[unsafe(method(init))]
98        #[unsafe(method_family = init)]
99        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
100
101        /// Support coding and decoding via NSKeyedArchiver.
102        ///
103        /// # Safety
104        ///
105        /// `a_decoder` possibly has further requirements.
106        #[unsafe(method(initWithCoder:))]
107        #[unsafe(method_family = init)]
108        pub unsafe fn initWithCoder(
109            this: Allocated<Self>,
110            a_decoder: &NSCoder,
111        ) -> Option<Retained<Self>>;
112
113        #[unsafe(method(node))]
114        #[unsafe(method_family = none)]
115        pub unsafe fn node(mtm: MainThreadMarker) -> Retained<Self>;
116
117        #[unsafe(method(nodeWithFileNamed:))]
118        #[unsafe(method_family = none)]
119        pub unsafe fn nodeWithFileNamed(
120            filename: &NSString,
121            mtm: MainThreadMarker,
122        ) -> Option<Retained<Self>>;
123
124        /// # Safety
125        ///
126        /// `classes` generic probably has further requirements.
127        #[unsafe(method(nodeWithFileNamed:securelyWithClasses:andError:_))]
128        #[unsafe(method_family = none)]
129        pub unsafe fn nodeWithFileNamed_securelyWithClasses_andError(
130            filename: &NSString,
131            classes: &NSSet<AnyClass>,
132            mtm: MainThreadMarker,
133        ) -> Result<Retained<Self>, Retained<NSError>>;
134    );
135}
136
137/// Methods declared on superclass `NSObject`.
138#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
139#[cfg(target_os = "macos")]
140impl SKCameraNode {
141    extern_methods!(
142        #[unsafe(method(new))]
143        #[unsafe(method_family = new)]
144        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
145    );
146}