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
61unsafe impl NSCoding for SKKeyframeSequence {}
62
63unsafe impl NSCopying for SKKeyframeSequence {}
64
65unsafe impl CopyingHelper for SKKeyframeSequence {
66    type Result = Self;
67}
68
69unsafe impl NSObjectProtocol for SKKeyframeSequence {}
70
71unsafe impl NSSecureCoding for SKKeyframeSequence {}
72
73impl SKKeyframeSequence {
74    extern_methods!(
75        #[unsafe(method(initWithKeyframeValues:times:))]
76        #[unsafe(method_family = init)]
77        pub unsafe fn initWithKeyframeValues_times(
78            this: Allocated<Self>,
79            values: &NSArray,
80            times: &NSArray<NSNumber>,
81        ) -> Retained<Self>;
82
83        #[unsafe(method(initWithCapacity:))]
84        #[unsafe(method_family = init)]
85        pub unsafe fn initWithCapacity(
86            this: Allocated<Self>,
87            num_items: NSUInteger,
88        ) -> Retained<Self>;
89
90        /// Support coding and decoding via NSKeyedArchiver.
91        #[unsafe(method(initWithCoder:))]
92        #[unsafe(method_family = init)]
93        pub unsafe fn initWithCoder(
94            this: Allocated<Self>,
95            a_decoder: &NSCoder,
96        ) -> Option<Retained<Self>>;
97
98        #[unsafe(method(count))]
99        #[unsafe(method_family = none)]
100        pub unsafe fn count(&self) -> NSUInteger;
101
102        #[cfg(feature = "objc2-core-foundation")]
103        #[unsafe(method(addKeyframeValue:time:))]
104        #[unsafe(method_family = none)]
105        pub unsafe fn addKeyframeValue_time(&self, value: &AnyObject, time: CGFloat);
106
107        #[unsafe(method(removeLastKeyframe))]
108        #[unsafe(method_family = none)]
109        pub unsafe fn removeLastKeyframe(&self);
110
111        #[unsafe(method(removeKeyframeAtIndex:))]
112        #[unsafe(method_family = none)]
113        pub unsafe fn removeKeyframeAtIndex(&self, index: NSUInteger);
114
115        #[unsafe(method(setKeyframeValue:forIndex:))]
116        #[unsafe(method_family = none)]
117        pub unsafe fn setKeyframeValue_forIndex(&self, value: &AnyObject, index: NSUInteger);
118
119        #[cfg(feature = "objc2-core-foundation")]
120        #[unsafe(method(setKeyframeTime:forIndex:))]
121        #[unsafe(method_family = none)]
122        pub unsafe fn setKeyframeTime_forIndex(&self, time: CGFloat, index: NSUInteger);
123
124        #[cfg(feature = "objc2-core-foundation")]
125        #[unsafe(method(setKeyframeValue:time:forIndex:))]
126        #[unsafe(method_family = none)]
127        pub unsafe fn setKeyframeValue_time_forIndex(
128            &self,
129            value: &AnyObject,
130            time: CGFloat,
131            index: NSUInteger,
132        );
133
134        #[unsafe(method(getKeyframeValueForIndex:))]
135        #[unsafe(method_family = none)]
136        pub unsafe fn getKeyframeValueForIndex(&self, index: NSUInteger) -> Retained<AnyObject>;
137
138        #[cfg(feature = "objc2-core-foundation")]
139        #[unsafe(method(getKeyframeTimeForIndex:))]
140        #[unsafe(method_family = none)]
141        pub unsafe fn getKeyframeTimeForIndex(&self, index: NSUInteger) -> CGFloat;
142
143        #[cfg(feature = "objc2-core-foundation")]
144        #[unsafe(method(sampleAtTime:))]
145        #[unsafe(method_family = none)]
146        pub unsafe fn sampleAtTime(&self, time: CGFloat) -> Option<Retained<AnyObject>>;
147
148        #[unsafe(method(interpolationMode))]
149        #[unsafe(method_family = none)]
150        pub unsafe fn interpolationMode(&self) -> SKInterpolationMode;
151
152        /// Setter for [`interpolationMode`][Self::interpolationMode].
153        #[unsafe(method(setInterpolationMode:))]
154        #[unsafe(method_family = none)]
155        pub unsafe fn setInterpolationMode(&self, interpolation_mode: SKInterpolationMode);
156
157        #[unsafe(method(repeatMode))]
158        #[unsafe(method_family = none)]
159        pub unsafe fn repeatMode(&self) -> SKRepeatMode;
160
161        /// Setter for [`repeatMode`][Self::repeatMode].
162        #[unsafe(method(setRepeatMode:))]
163        #[unsafe(method_family = none)]
164        pub unsafe fn setRepeatMode(&self, repeat_mode: SKRepeatMode);
165    );
166}
167
168/// Methods declared on superclass `NSObject`.
169impl SKKeyframeSequence {
170    extern_methods!(
171        #[unsafe(method(init))]
172        #[unsafe(method_family = init)]
173        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
174
175        #[unsafe(method(new))]
176        #[unsafe(method_family = new)]
177        pub unsafe fn new() -> Retained<Self>;
178    );
179}