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")]
41unsafe impl NSCoding for SKCameraNode {}
42
43#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
44#[cfg(target_os = "macos")]
45unsafe impl NSCopying for SKCameraNode {}
46
47#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
48#[cfg(target_os = "macos")]
49unsafe impl CopyingHelper for SKCameraNode {
50    type Result = Self;
51}
52
53#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
54#[cfg(target_os = "macos")]
55unsafe impl NSObjectProtocol for SKCameraNode {}
56
57#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
58#[cfg(target_os = "macos")]
59unsafe impl NSSecureCoding for SKCameraNode {}
60
61#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
62#[cfg(target_os = "macos")]
63impl SKCameraNode {
64    extern_methods!(
65        /// Checks if the node is contained inside the viewport of the camera.
66        /// The camera and node must both be in the same scene and presented on a view in order
67        /// to determine if the node is inside the camera viewport rectangle.
68        ///
69        ///
70        /// Returns: YES if the node is inside the viewport. NO if node is nil or the node is outside the viewport.
71        #[unsafe(method(containsNode:))]
72        #[unsafe(method_family = none)]
73        pub unsafe fn containsNode(&self, node: &SKNode) -> bool;
74
75        /// Returns the set of nodes in the same scene as the camera that are contained within its viewport.
76        ///
77        /// Returns: the set of nodes contained
78        #[unsafe(method(containedNodeSet))]
79        #[unsafe(method_family = none)]
80        pub unsafe fn containedNodeSet(&self) -> Retained<NSSet<SKNode>>;
81    );
82}
83
84/// Methods declared on superclass `SKNode`.
85#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
86#[cfg(target_os = "macos")]
87impl SKCameraNode {
88    extern_methods!(
89        #[unsafe(method(init))]
90        #[unsafe(method_family = init)]
91        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
92
93        /// Support coding and decoding via NSKeyedArchiver.
94        #[unsafe(method(initWithCoder:))]
95        #[unsafe(method_family = init)]
96        pub unsafe fn initWithCoder(
97            this: Allocated<Self>,
98            a_decoder: &NSCoder,
99        ) -> Option<Retained<Self>>;
100
101        #[unsafe(method(node))]
102        #[unsafe(method_family = none)]
103        pub unsafe fn node(mtm: MainThreadMarker) -> Retained<Self>;
104
105        #[unsafe(method(nodeWithFileNamed:))]
106        #[unsafe(method_family = none)]
107        pub unsafe fn nodeWithFileNamed(
108            filename: &NSString,
109            mtm: MainThreadMarker,
110        ) -> Option<Retained<Self>>;
111
112        #[unsafe(method(nodeWithFileNamed:securelyWithClasses:andError:_))]
113        #[unsafe(method_family = none)]
114        pub unsafe fn nodeWithFileNamed_securelyWithClasses_andError(
115            filename: &NSString,
116            classes: &NSSet<AnyClass>,
117            mtm: MainThreadMarker,
118        ) -> Result<Retained<Self>, Retained<NSError>>;
119    );
120}
121
122/// Methods declared on superclass `NSObject`.
123#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
124#[cfg(target_os = "macos")]
125impl SKCameraNode {
126    extern_methods!(
127        #[unsafe(method(new))]
128        #[unsafe(method_family = new)]
129        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
130    );
131}