objc2_gameplay_kit/generated/
GKMeshGraph.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct GKMeshGraphTriangulationMode(pub NSUInteger);
17bitflags::bitflags! {
18 impl GKMeshGraphTriangulationMode: NSUInteger {
19 #[doc(alias = "GKMeshGraphTriangulationModeVertices")]
20 const Vertices = 1<<0;
21 #[doc(alias = "GKMeshGraphTriangulationModeCenters")]
22 const Centers = 1<<1;
23 #[doc(alias = "GKMeshGraphTriangulationModeEdgeMidpoints")]
24 const EdgeMidpoints = 1<<2;
25 }
26}
27
28unsafe impl Encode for GKMeshGraphTriangulationMode {
29 const ENCODING: Encoding = NSUInteger::ENCODING;
30}
31
32unsafe impl RefEncode for GKMeshGraphTriangulationMode {
33 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
34}
35
36extern_class!(
37 #[unsafe(super(GKGraph, NSObject))]
41 #[derive(Debug, PartialEq, Eq, Hash)]
42 #[cfg(all(feature = "GKGraph", feature = "GKGraphNode"))]
43 pub struct GKMeshGraph<NodeType: ?Sized = AnyObject>;
44);
45
46#[cfg(all(feature = "GKGraph", feature = "GKGraphNode"))]
47impl<NodeType: ?Sized + Message + AsRef<GKGraphNode2D>> GKMeshGraph<NodeType> {
48 #[inline]
54 pub unsafe fn cast_unchecked<NewNodeType: ?Sized + Message + AsRef<GKGraphNode2D>>(
55 &self,
56 ) -> &GKMeshGraph<NewNodeType> {
57 unsafe { &*((self as *const Self).cast()) }
58 }
59}
60
61#[cfg(all(feature = "GKGraph", feature = "GKGraphNode"))]
62extern_conformance!(
63 unsafe impl<NodeType: ?Sized + NSCoding + AsRef<GKGraphNode2D>> NSCoding for GKMeshGraph<NodeType> {}
64);
65
66#[cfg(all(feature = "GKGraph", feature = "GKGraphNode"))]
67extern_conformance!(
68 unsafe impl<NodeType: ?Sized + AsRef<GKGraphNode2D>> NSCopying for GKMeshGraph<NodeType> {}
69);
70
71#[cfg(all(feature = "GKGraph", feature = "GKGraphNode"))]
72unsafe impl<NodeType: ?Sized + Message + AsRef<GKGraphNode2D>> CopyingHelper
73 for GKMeshGraph<NodeType>
74{
75 type Result = Self;
76}
77
78#[cfg(all(feature = "GKGraph", feature = "GKGraphNode"))]
79extern_conformance!(
80 unsafe impl<NodeType: ?Sized + AsRef<GKGraphNode2D>> NSObjectProtocol for GKMeshGraph<NodeType> {}
81);
82
83#[cfg(all(feature = "GKGraph", feature = "GKGraphNode"))]
84extern_conformance!(
85 unsafe impl<NodeType: ?Sized + NSSecureCoding + AsRef<GKGraphNode2D>> NSSecureCoding
86 for GKMeshGraph<NodeType>
87 {
88 }
89);
90
91#[cfg(all(feature = "GKGraph", feature = "GKGraphNode"))]
92impl<NodeType: Message + AsRef<GKGraphNode2D>> GKMeshGraph<NodeType> {
93 extern_methods!(
94 #[cfg(feature = "GKObstacle")]
95 #[unsafe(method(obstacles))]
97 #[unsafe(method_family = none)]
98 pub unsafe fn obstacles(&self) -> Retained<NSArray<GKPolygonObstacle>>;
99
100 #[unsafe(method(bufferRadius))]
103 #[unsafe(method_family = none)]
104 pub unsafe fn bufferRadius(&self) -> c_float;
105
106 #[unsafe(method(triangulationMode))]
112 #[unsafe(method_family = none)]
113 pub unsafe fn triangulationMode(&self) -> GKMeshGraphTriangulationMode;
114
115 #[unsafe(method(setTriangulationMode:))]
117 #[unsafe(method_family = none)]
118 pub unsafe fn setTriangulationMode(&self, triangulation_mode: GKMeshGraphTriangulationMode);
119
120 #[unsafe(method(triangleCount))]
122 #[unsafe(method_family = none)]
123 pub unsafe fn triangleCount(&self) -> NSUInteger;
124
125 #[cfg(feature = "GKObstacle")]
126 #[unsafe(method(addObstacles:))]
128 #[unsafe(method_family = none)]
129 pub unsafe fn addObstacles(&self, obstacles: &NSArray<GKPolygonObstacle>);
130
131 #[cfg(feature = "GKObstacle")]
132 #[unsafe(method(removeObstacles:))]
134 #[unsafe(method_family = none)]
135 pub unsafe fn removeObstacles(&self, obstacles: &NSArray<GKPolygonObstacle>);
136
137 #[unsafe(method(connectNodeUsingObstacles:))]
142 #[unsafe(method_family = none)]
143 pub unsafe fn connectNodeUsingObstacles(&self, node: &NodeType);
144
145 #[unsafe(method(triangulate))]
150 #[unsafe(method_family = none)]
151 pub unsafe fn triangulate(&self);
152
153 #[unsafe(method(classForGenericArgumentAtIndex:))]
155 #[unsafe(method_family = none)]
156 pub unsafe fn classForGenericArgumentAtIndex(&self, index: NSUInteger)
157 -> &'static AnyClass;
158 );
159}
160
161#[cfg(all(feature = "GKGraph", feature = "GKGraphNode"))]
163impl<NodeType: Message + AsRef<GKGraphNode2D>> GKMeshGraph<NodeType> {
164 extern_methods!(
165 #[unsafe(method(graphWithNodes:))]
169 #[unsafe(method_family = none)]
170 pub unsafe fn graphWithNodes(nodes: &NSArray<GKGraphNode>) -> Retained<Self>;
171
172 #[unsafe(method(initWithNodes:))]
173 #[unsafe(method_family = init)]
174 pub unsafe fn initWithNodes(
175 this: Allocated<Self>,
176 nodes: &NSArray<GKGraphNode>,
177 ) -> Retained<Self>;
178 );
179}
180
181#[cfg(all(feature = "GKGraph", feature = "GKGraphNode"))]
183impl<NodeType: Message + AsRef<GKGraphNode2D>> GKMeshGraph<NodeType> {
184 extern_methods!(
185 #[unsafe(method(init))]
186 #[unsafe(method_family = init)]
187 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
188
189 #[unsafe(method(new))]
190 #[unsafe(method_family = new)]
191 pub unsafe fn new() -> Retained<Self>;
192 );
193}