objc2_sprite_kit/generated/
SKConstraint.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::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12extern_class!(
13    /// SKRange object used to define a range of allowable values
14    ///
15    /// See also [Apple's documentation](https://developer.apple.com/documentation/spritekit/skrange?language=objc)
16    #[unsafe(super(NSObject))]
17    #[derive(Debug, PartialEq, Eq, Hash)]
18    pub struct SKRange;
19);
20
21extern_conformance!(
22    unsafe impl NSCoding for SKRange {}
23);
24
25extern_conformance!(
26    unsafe impl NSCopying for SKRange {}
27);
28
29unsafe impl CopyingHelper for SKRange {
30    type Result = Self;
31}
32
33extern_conformance!(
34    unsafe impl NSObjectProtocol for SKRange {}
35);
36
37extern_conformance!(
38    unsafe impl NSSecureCoding for SKRange {}
39);
40
41impl SKRange {
42    extern_methods!(
43        #[cfg(feature = "objc2-core-foundation")]
44        #[unsafe(method(initWithLowerLimit:upperLimit:))]
45        #[unsafe(method_family = init)]
46        pub unsafe fn initWithLowerLimit_upperLimit(
47            this: Allocated<Self>,
48            lower: CGFloat,
49            upper: CGFloat,
50        ) -> Retained<Self>;
51
52        #[cfg(feature = "objc2-core-foundation")]
53        #[unsafe(method(rangeWithLowerLimit:upperLimit:))]
54        #[unsafe(method_family = none)]
55        pub unsafe fn rangeWithLowerLimit_upperLimit(
56            lower: CGFloat,
57            upper: CGFloat,
58        ) -> Retained<Self>;
59
60        #[cfg(feature = "objc2-core-foundation")]
61        #[unsafe(method(rangeWithLowerLimit:))]
62        #[unsafe(method_family = none)]
63        pub unsafe fn rangeWithLowerLimit(lower: CGFloat) -> Retained<Self>;
64
65        #[cfg(feature = "objc2-core-foundation")]
66        #[unsafe(method(rangeWithUpperLimit:))]
67        #[unsafe(method_family = none)]
68        pub unsafe fn rangeWithUpperLimit(upper: CGFloat) -> Retained<Self>;
69
70        #[cfg(feature = "objc2-core-foundation")]
71        #[unsafe(method(rangeWithConstantValue:))]
72        #[unsafe(method_family = none)]
73        pub unsafe fn rangeWithConstantValue(value: CGFloat) -> Retained<Self>;
74
75        #[cfg(feature = "objc2-core-foundation")]
76        #[unsafe(method(rangeWithValue:variance:))]
77        #[unsafe(method_family = none)]
78        pub unsafe fn rangeWithValue_variance(value: CGFloat, variance: CGFloat) -> Retained<Self>;
79
80        #[unsafe(method(rangeWithNoLimits))]
81        #[unsafe(method_family = none)]
82        pub unsafe fn rangeWithNoLimits() -> Retained<Self>;
83
84        #[cfg(feature = "objc2-core-foundation")]
85        #[unsafe(method(lowerLimit))]
86        #[unsafe(method_family = none)]
87        pub unsafe fn lowerLimit(&self) -> CGFloat;
88
89        #[cfg(feature = "objc2-core-foundation")]
90        /// Setter for [`lowerLimit`][Self::lowerLimit].
91        #[unsafe(method(setLowerLimit:))]
92        #[unsafe(method_family = none)]
93        pub unsafe fn setLowerLimit(&self, lower_limit: CGFloat);
94
95        #[cfg(feature = "objc2-core-foundation")]
96        #[unsafe(method(upperLimit))]
97        #[unsafe(method_family = none)]
98        pub unsafe fn upperLimit(&self) -> CGFloat;
99
100        #[cfg(feature = "objc2-core-foundation")]
101        /// Setter for [`upperLimit`][Self::upperLimit].
102        #[unsafe(method(setUpperLimit:))]
103        #[unsafe(method_family = none)]
104        pub unsafe fn setUpperLimit(&self, upper_limit: CGFloat);
105    );
106}
107
108/// Methods declared on superclass `NSObject`.
109impl SKRange {
110    extern_methods!(
111        #[unsafe(method(init))]
112        #[unsafe(method_family = init)]
113        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
114
115        #[unsafe(method(new))]
116        #[unsafe(method_family = new)]
117        pub unsafe fn new() -> Retained<Self>;
118    );
119}
120
121extern_class!(
122    /// SKConstraints are evaluated each frame after actions and physics.
123    /// The node's transform will be changed to staisfy the constarint
124    ///
125    /// See also [Apple's documentation](https://developer.apple.com/documentation/spritekit/skconstraint?language=objc)
126    #[unsafe(super(NSObject))]
127    #[derive(Debug, PartialEq, Eq, Hash)]
128    pub struct SKConstraint;
129);
130
131extern_conformance!(
132    unsafe impl NSCoding for SKConstraint {}
133);
134
135extern_conformance!(
136    unsafe impl NSCopying for SKConstraint {}
137);
138
139unsafe impl CopyingHelper for SKConstraint {
140    type Result = Self;
141}
142
143extern_conformance!(
144    unsafe impl NSObjectProtocol for SKConstraint {}
145);
146
147extern_conformance!(
148    unsafe impl NSSecureCoding for SKConstraint {}
149);
150
151impl SKConstraint {
152    extern_methods!(
153        #[unsafe(method(enabled))]
154        #[unsafe(method_family = none)]
155        pub unsafe fn enabled(&self) -> bool;
156
157        /// Setter for [`enabled`][Self::enabled].
158        #[unsafe(method(setEnabled:))]
159        #[unsafe(method_family = none)]
160        pub unsafe fn setEnabled(&self, enabled: bool);
161
162        #[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
163        #[cfg(target_os = "macos")]
164        #[unsafe(method(referenceNode))]
165        #[unsafe(method_family = none)]
166        pub unsafe fn referenceNode(&self, mtm: MainThreadMarker) -> Option<Retained<SKNode>>;
167
168        #[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
169        #[cfg(target_os = "macos")]
170        /// Setter for [`referenceNode`][Self::referenceNode].
171        #[unsafe(method(setReferenceNode:))]
172        #[unsafe(method_family = none)]
173        pub unsafe fn setReferenceNode(&self, reference_node: Option<&SKNode>);
174
175        /// Constrain the node's position to a range
176        #[unsafe(method(positionX:))]
177        #[unsafe(method_family = none)]
178        pub unsafe fn positionX(range: &SKRange) -> Retained<Self>;
179
180        #[unsafe(method(positionY:))]
181        #[unsafe(method_family = none)]
182        pub unsafe fn positionY(range: &SKRange) -> Retained<Self>;
183
184        #[unsafe(method(positionX:Y:))]
185        #[unsafe(method_family = none)]
186        pub unsafe fn positionX_Y(x_range: &SKRange, y_range: &SKRange) -> Retained<Self>;
187
188        #[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
189        #[cfg(target_os = "macos")]
190        /// Constrain the node's position to be within a distance of a point or node
191        #[unsafe(method(distance:toNode:))]
192        #[unsafe(method_family = none)]
193        pub unsafe fn distance_toNode(range: &SKRange, node: &SKNode) -> Retained<Self>;
194
195        #[cfg(feature = "objc2-core-foundation")]
196        #[unsafe(method(distance:toPoint:))]
197        #[unsafe(method_family = none)]
198        pub unsafe fn distance_toPoint(range: &SKRange, point: CGPoint) -> Retained<Self>;
199
200        #[cfg(all(
201            feature = "SKNode",
202            feature = "objc2-app-kit",
203            feature = "objc2-core-foundation"
204        ))]
205        #[cfg(target_os = "macos")]
206        #[unsafe(method(distance:toPoint:inNode:))]
207        #[unsafe(method_family = none)]
208        pub unsafe fn distance_toPoint_inNode(
209            range: &SKRange,
210            point: CGPoint,
211            node: &SKNode,
212        ) -> Retained<Self>;
213
214        /// Constrain the node's rotation to a range
215        #[unsafe(method(zRotation:))]
216        #[unsafe(method_family = none)]
217        pub unsafe fn zRotation(z_range: &SKRange) -> Retained<Self>;
218
219        #[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
220        #[cfg(target_os = "macos")]
221        /// Constrain the node's rotation to orient to a point or node
222        #[unsafe(method(orientToNode:offset:))]
223        #[unsafe(method_family = none)]
224        pub unsafe fn orientToNode_offset(node: &SKNode, radians: &SKRange) -> Retained<Self>;
225
226        #[cfg(feature = "objc2-core-foundation")]
227        #[unsafe(method(orientToPoint:offset:))]
228        #[unsafe(method_family = none)]
229        pub unsafe fn orientToPoint_offset(point: CGPoint, radians: &SKRange) -> Retained<Self>;
230
231        #[cfg(all(
232            feature = "SKNode",
233            feature = "objc2-app-kit",
234            feature = "objc2-core-foundation"
235        ))]
236        #[cfg(target_os = "macos")]
237        #[unsafe(method(orientToPoint:inNode:offset:))]
238        #[unsafe(method_family = none)]
239        pub unsafe fn orientToPoint_inNode_offset(
240            point: CGPoint,
241            node: &SKNode,
242            radians: &SKRange,
243        ) -> Retained<Self>;
244    );
245}
246
247/// Methods declared on superclass `NSObject`.
248impl SKConstraint {
249    extern_methods!(
250        #[unsafe(method(init))]
251        #[unsafe(method_family = init)]
252        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
253
254        #[unsafe(method(new))]
255        #[unsafe(method_family = new)]
256        pub unsafe fn new() -> Retained<Self>;
257    );
258}