objc2_gameplay_kit/generated/
GKScene.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::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_protocol!(
11    /// Protocol that specifies the type of objects that can be used as root nodes of a GKScene.
12    ///
13    ///
14    /// See: GKScene.rootNode
15    ///
16    /// See also [Apple's documentation](https://developer.apple.com/documentation/gameplaykit/gkscenerootnodetype?language=objc)
17    pub unsafe trait GKSceneRootNodeType: NSObjectProtocol {}
18);
19
20extern_class!(
21    /// A scene stores and handles loading of data related to a particular scene.
22    ///
23    /// See also [Apple's documentation](https://developer.apple.com/documentation/gameplaykit/gkscene?language=objc)
24    #[unsafe(super(NSObject))]
25    #[derive(Debug, PartialEq, Eq, Hash)]
26    pub struct GKScene;
27);
28
29extern_conformance!(
30    unsafe impl NSCoding for GKScene {}
31);
32
33extern_conformance!(
34    unsafe impl NSCopying for GKScene {}
35);
36
37unsafe impl CopyingHelper for GKScene {
38    type Result = Self;
39}
40
41extern_conformance!(
42    unsafe impl NSObjectProtocol for GKScene {}
43);
44
45extern_conformance!(
46    unsafe impl NSSecureCoding for GKScene {}
47);
48
49impl GKScene {
50    extern_methods!(
51        /// Loads a scene from a file contained within the bundle.
52        #[unsafe(method(sceneWithFileNamed:))]
53        #[unsafe(method_family = none)]
54        pub unsafe fn sceneWithFileNamed(filename: &NSString) -> Option<Retained<Self>>;
55
56        /// Loads a scene from a file contained within the bundle and link with the specified rootNode.
57        #[unsafe(method(sceneWithFileNamed:rootNode:))]
58        #[unsafe(method_family = none)]
59        pub unsafe fn sceneWithFileNamed_rootNode(
60            filename: &NSString,
61            root_node: &ProtocolObject<dyn GKSceneRootNodeType>,
62        ) -> Option<Retained<Self>>;
63
64        #[cfg(feature = "GKEntity")]
65        /// The entities of this scene.
66        #[unsafe(method(entities))]
67        #[unsafe(method_family = none)]
68        pub unsafe fn entities(&self) -> Retained<NSArray<GKEntity>>;
69
70        /// The root node for the scene.
71        ///
72        ///
73        /// See: GKSceneRootNodeType
74        #[unsafe(method(rootNode))]
75        #[unsafe(method_family = none)]
76        pub unsafe fn rootNode(&self) -> Option<Retained<ProtocolObject<dyn GKSceneRootNodeType>>>;
77
78        /// Setter for [`rootNode`][Self::rootNode].
79        #[unsafe(method(setRootNode:))]
80        #[unsafe(method_family = none)]
81        pub unsafe fn setRootNode(
82            &self,
83            root_node: Option<&ProtocolObject<dyn GKSceneRootNodeType>>,
84        );
85
86        #[cfg(feature = "GKGraph")]
87        /// The navigational graphs of this scene.
88        #[unsafe(method(graphs))]
89        #[unsafe(method_family = none)]
90        pub unsafe fn graphs(&self) -> Retained<NSDictionary<NSString, GKGraph>>;
91
92        #[cfg(feature = "GKEntity")]
93        /// Adds an entity to the scene's list of entities.
94        ///
95        ///
96        /// Parameter `entity`: the entity to add.
97        #[unsafe(method(addEntity:))]
98        #[unsafe(method_family = none)]
99        pub unsafe fn addEntity(&self, entity: &GKEntity);
100
101        #[cfg(feature = "GKEntity")]
102        /// Removes an entity from the scene's list of entities.
103        ///
104        ///
105        /// Parameter `entity`: the entity to remove.
106        #[unsafe(method(removeEntity:))]
107        #[unsafe(method_family = none)]
108        pub unsafe fn removeEntity(&self, entity: &GKEntity);
109
110        #[cfg(feature = "GKGraph")]
111        /// Adds a graph to the scene's list of graphs.
112        ///
113        ///
114        /// Parameter `graph`: the graph to add.
115        #[unsafe(method(addGraph:name:))]
116        #[unsafe(method_family = none)]
117        pub unsafe fn addGraph_name(&self, graph: &GKGraph, name: &NSString);
118
119        /// Removes a graph from the scene's list of graphs.
120        ///
121        ///
122        /// Parameter `name`: the name of the corresponding graph as added via addGraph:
123        #[unsafe(method(removeGraph:))]
124        #[unsafe(method_family = none)]
125        pub unsafe fn removeGraph(&self, name: &NSString);
126    );
127}
128
129/// Methods declared on superclass `NSObject`.
130impl GKScene {
131    extern_methods!(
132        #[unsafe(method(init))]
133        #[unsafe(method_family = init)]
134        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
135
136        #[unsafe(method(new))]
137        #[unsafe(method_family = new)]
138        pub unsafe fn new() -> Retained<Self>;
139    );
140}