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