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
36unsafe impl NSCoding for SKPhysicsWorld {}
37
38unsafe impl NSObjectProtocol for SKPhysicsWorld {}
39
40unsafe impl NSSecureCoding for SKPhysicsWorld {}
41
42impl SKPhysicsWorld {
43 extern_methods!(
44 #[cfg(feature = "objc2-core-foundation")]
45 #[unsafe(method(gravity))]
47 #[unsafe(method_family = none)]
48 pub unsafe fn gravity(&self) -> CGVector;
49
50 #[cfg(feature = "objc2-core-foundation")]
51 #[unsafe(method(setGravity:))]
53 #[unsafe(method_family = none)]
54 pub unsafe fn setGravity(&self, gravity: CGVector);
55
56 #[cfg(feature = "objc2-core-foundation")]
57 #[unsafe(method(speed))]
58 #[unsafe(method_family = none)]
59 pub unsafe fn speed(&self) -> CGFloat;
60
61 #[cfg(feature = "objc2-core-foundation")]
62 #[unsafe(method(setSpeed:))]
64 #[unsafe(method_family = none)]
65 pub unsafe fn setSpeed(&self, speed: CGFloat);
66
67 #[unsafe(method(contactDelegate))]
68 #[unsafe(method_family = none)]
69 pub unsafe fn contactDelegate(
70 &self,
71 ) -> Option<Retained<ProtocolObject<dyn SKPhysicsContactDelegate>>>;
72
73 #[unsafe(method(setContactDelegate:))]
75 #[unsafe(method_family = none)]
76 pub unsafe fn setContactDelegate(
77 &self,
78 contact_delegate: Option<&ProtocolObject<dyn SKPhysicsContactDelegate>>,
79 );
80
81 #[cfg(feature = "SKPhysicsJoint")]
82 #[unsafe(method(addJoint:))]
83 #[unsafe(method_family = none)]
84 pub unsafe fn addJoint(&self, joint: &SKPhysicsJoint);
85
86 #[cfg(feature = "SKPhysicsJoint")]
87 #[unsafe(method(removeJoint:))]
88 #[unsafe(method_family = none)]
89 pub unsafe fn removeJoint(&self, joint: &SKPhysicsJoint);
90
91 #[unsafe(method(removeAllJoints))]
92 #[unsafe(method_family = none)]
93 pub unsafe fn removeAllJoints(&self);
94
95 #[cfg(all(feature = "SKPhysicsBody", feature = "objc2-core-foundation"))]
96 #[unsafe(method(bodyAtPoint:))]
97 #[unsafe(method_family = none)]
98 pub unsafe fn bodyAtPoint(&self, point: CGPoint) -> Option<Retained<SKPhysicsBody>>;
99
100 #[cfg(all(feature = "SKPhysicsBody", feature = "objc2-core-foundation"))]
101 #[unsafe(method(bodyInRect:))]
102 #[unsafe(method_family = none)]
103 pub unsafe fn bodyInRect(&self, rect: CGRect) -> Option<Retained<SKPhysicsBody>>;
104
105 #[cfg(all(feature = "SKPhysicsBody", feature = "objc2-core-foundation"))]
106 #[unsafe(method(bodyAlongRayStart:end:))]
107 #[unsafe(method_family = none)]
108 pub unsafe fn bodyAlongRayStart_end(
109 &self,
110 start: CGPoint,
111 end: CGPoint,
112 ) -> Option<Retained<SKPhysicsBody>>;
113
114 #[cfg(all(
115 feature = "SKPhysicsBody",
116 feature = "block2",
117 feature = "objc2-core-foundation"
118 ))]
119 #[unsafe(method(enumerateBodiesAtPoint:usingBlock:))]
120 #[unsafe(method_family = none)]
121 pub unsafe fn enumerateBodiesAtPoint_usingBlock(
122 &self,
123 point: CGPoint,
124 block: &block2::Block<dyn Fn(NonNull<SKPhysicsBody>, NonNull<Bool>)>,
125 );
126
127 #[cfg(all(
128 feature = "SKPhysicsBody",
129 feature = "block2",
130 feature = "objc2-core-foundation"
131 ))]
132 #[unsafe(method(enumerateBodiesInRect:usingBlock:))]
133 #[unsafe(method_family = none)]
134 pub unsafe fn enumerateBodiesInRect_usingBlock(
135 &self,
136 rect: CGRect,
137 block: &block2::Block<dyn Fn(NonNull<SKPhysicsBody>, NonNull<Bool>)>,
138 );
139
140 #[cfg(all(
141 feature = "SKPhysicsBody",
142 feature = "block2",
143 feature = "objc2-core-foundation"
144 ))]
145 #[unsafe(method(enumerateBodiesAlongRayStart:end:usingBlock:))]
146 #[unsafe(method_family = none)]
147 pub unsafe fn enumerateBodiesAlongRayStart_end_usingBlock(
148 &self,
149 start: CGPoint,
150 end: CGPoint,
151 block: &block2::Block<dyn Fn(NonNull<SKPhysicsBody>, CGPoint, CGVector, NonNull<Bool>)>,
152 );
153 );
154}
155
156impl SKPhysicsWorld {
158 extern_methods!(
159 #[unsafe(method(init))]
160 #[unsafe(method_family = init)]
161 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
162
163 #[unsafe(method(new))]
164 #[unsafe(method_family = new)]
165 pub unsafe fn new() -> Retained<Self>;
166 );
167}