objc2_sprite_kit/generated/
SKPhysicsWorld.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12extern_protocol!(
13 pub unsafe trait SKPhysicsContactDelegate: NSObjectProtocol {
15 #[cfg(feature = "SKPhysicsContact")]
16 #[optional]
17 #[unsafe(method(didBeginContact:))]
18 #[unsafe(method_family = none)]
19 unsafe fn didBeginContact(&self, contact: &SKPhysicsContact);
20
21 #[cfg(feature = "SKPhysicsContact")]
22 #[optional]
23 #[unsafe(method(didEndContact:))]
24 #[unsafe(method_family = none)]
25 unsafe fn didEndContact(&self, contact: &SKPhysicsContact);
26 }
27);
28
29extern_class!(
30 #[unsafe(super(NSObject))]
32 #[derive(Debug, PartialEq, Eq, Hash)]
33 pub struct SKPhysicsWorld;
34);
35
36extern_conformance!(
37 unsafe impl NSCoding for SKPhysicsWorld {}
38);
39
40extern_conformance!(
41 unsafe impl NSObjectProtocol for SKPhysicsWorld {}
42);
43
44extern_conformance!(
45 unsafe impl NSSecureCoding for SKPhysicsWorld {}
46);
47
48impl SKPhysicsWorld {
49 extern_methods!(
50 #[cfg(feature = "objc2-core-foundation")]
51 #[unsafe(method(gravity))]
53 #[unsafe(method_family = none)]
54 pub unsafe fn gravity(&self) -> CGVector;
55
56 #[cfg(feature = "objc2-core-foundation")]
57 #[unsafe(method(setGravity:))]
59 #[unsafe(method_family = none)]
60 pub unsafe fn setGravity(&self, gravity: CGVector);
61
62 #[cfg(feature = "objc2-core-foundation")]
63 #[unsafe(method(speed))]
64 #[unsafe(method_family = none)]
65 pub unsafe fn speed(&self) -> CGFloat;
66
67 #[cfg(feature = "objc2-core-foundation")]
68 #[unsafe(method(setSpeed:))]
70 #[unsafe(method_family = none)]
71 pub unsafe fn setSpeed(&self, speed: CGFloat);
72
73 #[unsafe(method(contactDelegate))]
74 #[unsafe(method_family = none)]
75 pub unsafe fn contactDelegate(
76 &self,
77 ) -> Option<Retained<ProtocolObject<dyn SKPhysicsContactDelegate>>>;
78
79 #[unsafe(method(setContactDelegate:))]
81 #[unsafe(method_family = none)]
82 pub unsafe fn setContactDelegate(
83 &self,
84 contact_delegate: Option<&ProtocolObject<dyn SKPhysicsContactDelegate>>,
85 );
86
87 #[cfg(feature = "SKPhysicsJoint")]
88 #[unsafe(method(addJoint:))]
89 #[unsafe(method_family = none)]
90 pub unsafe fn addJoint(&self, joint: &SKPhysicsJoint);
91
92 #[cfg(feature = "SKPhysicsJoint")]
93 #[unsafe(method(removeJoint:))]
94 #[unsafe(method_family = none)]
95 pub unsafe fn removeJoint(&self, joint: &SKPhysicsJoint);
96
97 #[unsafe(method(removeAllJoints))]
98 #[unsafe(method_family = none)]
99 pub unsafe fn removeAllJoints(&self);
100
101 #[cfg(all(feature = "SKPhysicsBody", feature = "objc2-core-foundation"))]
102 #[unsafe(method(bodyAtPoint:))]
103 #[unsafe(method_family = none)]
104 pub unsafe fn bodyAtPoint(&self, point: CGPoint) -> Option<Retained<SKPhysicsBody>>;
105
106 #[cfg(all(feature = "SKPhysicsBody", feature = "objc2-core-foundation"))]
107 #[unsafe(method(bodyInRect:))]
108 #[unsafe(method_family = none)]
109 pub unsafe fn bodyInRect(&self, rect: CGRect) -> Option<Retained<SKPhysicsBody>>;
110
111 #[cfg(all(feature = "SKPhysicsBody", feature = "objc2-core-foundation"))]
112 #[unsafe(method(bodyAlongRayStart:end:))]
113 #[unsafe(method_family = none)]
114 pub unsafe fn bodyAlongRayStart_end(
115 &self,
116 start: CGPoint,
117 end: CGPoint,
118 ) -> Option<Retained<SKPhysicsBody>>;
119
120 #[cfg(all(
121 feature = "SKPhysicsBody",
122 feature = "block2",
123 feature = "objc2-core-foundation"
124 ))]
125 #[unsafe(method(enumerateBodiesAtPoint:usingBlock:))]
126 #[unsafe(method_family = none)]
127 pub unsafe fn enumerateBodiesAtPoint_usingBlock(
128 &self,
129 point: CGPoint,
130 block: &block2::DynBlock<dyn Fn(NonNull<SKPhysicsBody>, NonNull<Bool>)>,
131 );
132
133 #[cfg(all(
134 feature = "SKPhysicsBody",
135 feature = "block2",
136 feature = "objc2-core-foundation"
137 ))]
138 #[unsafe(method(enumerateBodiesInRect:usingBlock:))]
139 #[unsafe(method_family = none)]
140 pub unsafe fn enumerateBodiesInRect_usingBlock(
141 &self,
142 rect: CGRect,
143 block: &block2::DynBlock<dyn Fn(NonNull<SKPhysicsBody>, NonNull<Bool>)>,
144 );
145
146 #[cfg(all(
147 feature = "SKPhysicsBody",
148 feature = "block2",
149 feature = "objc2-core-foundation"
150 ))]
151 #[unsafe(method(enumerateBodiesAlongRayStart:end:usingBlock:))]
152 #[unsafe(method_family = none)]
153 pub unsafe fn enumerateBodiesAlongRayStart_end_usingBlock(
154 &self,
155 start: CGPoint,
156 end: CGPoint,
157 block: &block2::DynBlock<
158 dyn Fn(NonNull<SKPhysicsBody>, CGPoint, CGVector, NonNull<Bool>),
159 >,
160 );
161 );
162}
163
164impl SKPhysicsWorld {
166 extern_methods!(
167 #[unsafe(method(init))]
168 #[unsafe(method_family = init)]
169 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
170
171 #[unsafe(method(new))]
172 #[unsafe(method_family = new)]
173 pub unsafe fn new() -> Retained<Self>;
174 );
175}