objc2_sprite_kit/generated/
SKKeyframeSequence.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
12/// [Apple's documentation](https://developer.apple.com/documentation/spritekit/skinterpolationmode?language=objc)
13// NS_ENUM
14#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct SKInterpolationMode(pub NSInteger);
17impl SKInterpolationMode {
18    #[doc(alias = "SKInterpolationModeLinear")]
19    pub const Linear: Self = Self(1);
20    #[doc(alias = "SKInterpolationModeSpline")]
21    pub const Spline: Self = Self(2);
22    #[doc(alias = "SKInterpolationModeStep")]
23    pub const Step: Self = Self(3);
24}
25
26unsafe impl Encode for SKInterpolationMode {
27    const ENCODING: Encoding = NSInteger::ENCODING;
28}
29
30unsafe impl RefEncode for SKInterpolationMode {
31    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
32}
33
34/// [Apple's documentation](https://developer.apple.com/documentation/spritekit/skrepeatmode?language=objc)
35// NS_ENUM
36#[repr(transparent)]
37#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
38pub struct SKRepeatMode(pub NSInteger);
39impl SKRepeatMode {
40    #[doc(alias = "SKRepeatModeClamp")]
41    pub const Clamp: Self = Self(1);
42    #[doc(alias = "SKRepeatModeLoop")]
43    pub const Loop: Self = Self(2);
44}
45
46unsafe impl Encode for SKRepeatMode {
47    const ENCODING: Encoding = NSInteger::ENCODING;
48}
49
50unsafe impl RefEncode for SKRepeatMode {
51    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
52}
53
54extern_class!(
55    /// [Apple's documentation](https://developer.apple.com/documentation/spritekit/skkeyframesequence?language=objc)
56    #[unsafe(super(NSObject))]
57    #[derive(Debug, PartialEq, Eq, Hash)]
58    pub struct SKKeyframeSequence;
59);
60
61extern_conformance!(
62    unsafe impl NSCoding for SKKeyframeSequence {}
63);
64
65extern_conformance!(
66    unsafe impl NSCopying for SKKeyframeSequence {}
67);
68
69unsafe impl CopyingHelper for SKKeyframeSequence {
70    type Result = Self;
71}
72
73extern_conformance!(
74    unsafe impl NSObjectProtocol for SKKeyframeSequence {}
75);
76
77extern_conformance!(
78    unsafe impl NSSecureCoding for SKKeyframeSequence {}
79);
80
81impl SKKeyframeSequence {
82    extern_methods!(
83        /// # Safety
84        ///
85        /// `values` generic should be of the correct type.
86        #[unsafe(method(initWithKeyframeValues:times:))]
87        #[unsafe(method_family = init)]
88        pub unsafe fn initWithKeyframeValues_times(
89            this: Allocated<Self>,
90            values: &NSArray,
91            times: &NSArray<NSNumber>,
92        ) -> Retained<Self>;
93
94        #[unsafe(method(initWithCapacity:))]
95        #[unsafe(method_family = init)]
96        pub unsafe fn initWithCapacity(
97            this: Allocated<Self>,
98            num_items: NSUInteger,
99        ) -> Retained<Self>;
100
101        /// Support coding and decoding via NSKeyedArchiver.
102        ///
103        /// # Safety
104        ///
105        /// `a_decoder` possibly has further requirements.
106        #[unsafe(method(initWithCoder:))]
107        #[unsafe(method_family = init)]
108        pub unsafe fn initWithCoder(
109            this: Allocated<Self>,
110            a_decoder: &NSCoder,
111        ) -> Option<Retained<Self>>;
112
113        #[unsafe(method(count))]
114        #[unsafe(method_family = none)]
115        pub unsafe fn count(&self) -> NSUInteger;
116
117        #[cfg(feature = "objc2-core-foundation")]
118        /// # Safety
119        ///
120        /// `value` should be of the correct type.
121        #[unsafe(method(addKeyframeValue:time:))]
122        #[unsafe(method_family = none)]
123        pub unsafe fn addKeyframeValue_time(&self, value: &AnyObject, time: CGFloat);
124
125        #[unsafe(method(removeLastKeyframe))]
126        #[unsafe(method_family = none)]
127        pub unsafe fn removeLastKeyframe(&self);
128
129        #[unsafe(method(removeKeyframeAtIndex:))]
130        #[unsafe(method_family = none)]
131        pub unsafe fn removeKeyframeAtIndex(&self, index: NSUInteger);
132
133        /// # Safety
134        ///
135        /// `value` should be of the correct type.
136        #[unsafe(method(setKeyframeValue:forIndex:))]
137        #[unsafe(method_family = none)]
138        pub unsafe fn setKeyframeValue_forIndex(&self, value: &AnyObject, index: NSUInteger);
139
140        #[cfg(feature = "objc2-core-foundation")]
141        #[unsafe(method(setKeyframeTime:forIndex:))]
142        #[unsafe(method_family = none)]
143        pub unsafe fn setKeyframeTime_forIndex(&self, time: CGFloat, index: NSUInteger);
144
145        #[cfg(feature = "objc2-core-foundation")]
146        /// # Safety
147        ///
148        /// `value` should be of the correct type.
149        #[unsafe(method(setKeyframeValue:time:forIndex:))]
150        #[unsafe(method_family = none)]
151        pub unsafe fn setKeyframeValue_time_forIndex(
152            &self,
153            value: &AnyObject,
154            time: CGFloat,
155            index: NSUInteger,
156        );
157
158        #[unsafe(method(getKeyframeValueForIndex:))]
159        #[unsafe(method_family = none)]
160        pub unsafe fn getKeyframeValueForIndex(&self, index: NSUInteger) -> Retained<AnyObject>;
161
162        #[cfg(feature = "objc2-core-foundation")]
163        #[unsafe(method(getKeyframeTimeForIndex:))]
164        #[unsafe(method_family = none)]
165        pub unsafe fn getKeyframeTimeForIndex(&self, index: NSUInteger) -> CGFloat;
166
167        #[cfg(feature = "objc2-core-foundation")]
168        #[unsafe(method(sampleAtTime:))]
169        #[unsafe(method_family = none)]
170        pub unsafe fn sampleAtTime(&self, time: CGFloat) -> Option<Retained<AnyObject>>;
171
172        #[unsafe(method(interpolationMode))]
173        #[unsafe(method_family = none)]
174        pub unsafe fn interpolationMode(&self) -> SKInterpolationMode;
175
176        /// Setter for [`interpolationMode`][Self::interpolationMode].
177        #[unsafe(method(setInterpolationMode:))]
178        #[unsafe(method_family = none)]
179        pub unsafe fn setInterpolationMode(&self, interpolation_mode: SKInterpolationMode);
180
181        #[unsafe(method(repeatMode))]
182        #[unsafe(method_family = none)]
183        pub unsafe fn repeatMode(&self) -> SKRepeatMode;
184
185        /// Setter for [`repeatMode`][Self::repeatMode].
186        #[unsafe(method(setRepeatMode:))]
187        #[unsafe(method_family = none)]
188        pub unsafe fn setRepeatMode(&self, repeat_mode: SKRepeatMode);
189    );
190}
191
192/// Methods declared on superclass `NSObject`.
193impl SKKeyframeSequence {
194    extern_methods!(
195        #[unsafe(method(init))]
196        #[unsafe(method_family = init)]
197        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
198
199        #[unsafe(method(new))]
200        #[unsafe(method_family = new)]
201        pub unsafe fn new() -> Retained<Self>;
202    );
203}