objc2_gameplay_kit/generated/
GKComponent.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11 #[unsafe(super(NSObject))]
22 #[derive(Debug, PartialEq, Eq, Hash)]
23 pub struct GKComponent;
24);
25
26extern_conformance!(
27 unsafe impl NSCoding for GKComponent {}
28);
29
30extern_conformance!(
31 unsafe impl NSCopying for GKComponent {}
32);
33
34unsafe impl CopyingHelper for GKComponent {
35 type Result = Self;
36}
37
38extern_conformance!(
39 unsafe impl NSObjectProtocol for GKComponent {}
40);
41
42extern_conformance!(
43 unsafe impl NSSecureCoding for GKComponent {}
44);
45
46impl GKComponent {
47 extern_methods!(
48 #[cfg(feature = "GKEntity")]
49 #[unsafe(method(entity))]
51 #[unsafe(method_family = none)]
52 pub unsafe fn entity(&self) -> Option<Retained<GKEntity>>;
53
54 #[unsafe(method(updateWithDeltaTime:))]
57 #[unsafe(method_family = none)]
58 pub unsafe fn updateWithDeltaTime(&self, seconds: NSTimeInterval);
59
60 #[unsafe(method(didAddToEntity))]
62 #[unsafe(method_family = none)]
63 pub unsafe fn didAddToEntity(&self);
64
65 #[unsafe(method(willRemoveFromEntity))]
67 #[unsafe(method_family = none)]
68 pub unsafe fn willRemoveFromEntity(&self);
69 );
70}
71
72impl GKComponent {
74 extern_methods!(
75 #[unsafe(method(init))]
76 #[unsafe(method_family = init)]
77 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
78
79 #[unsafe(method(new))]
80 #[unsafe(method_family = new)]
81 pub unsafe fn new() -> Retained<Self>;
82 );
83}
84
85extern_class!(
86 #[unsafe(super(NSObject))]
91 #[derive(Debug, PartialEq, Eq, Hash)]
92 pub struct GKComponentSystem<ComponentType: ?Sized = AnyObject>;
93);
94
95impl<ComponentType: ?Sized + Message + AsRef<GKComponent>> GKComponentSystem<ComponentType> {
96 #[inline]
102 pub unsafe fn cast_unchecked<NewComponentType: ?Sized + Message + AsRef<GKComponent>>(
103 &self,
104 ) -> &GKComponentSystem<NewComponentType> {
105 unsafe { &*((self as *const Self).cast()) }
106 }
107}
108
109extern_conformance!(
110 unsafe impl<ComponentType: ?Sized + AsRef<GKComponent>> NSFastEnumeration
111 for GKComponentSystem<ComponentType>
112 {
113 }
114);
115
116extern_conformance!(
117 unsafe impl<ComponentType: ?Sized + AsRef<GKComponent>> NSObjectProtocol
118 for GKComponentSystem<ComponentType>
119 {
120 }
121);
122
123impl<ComponentType: Message + AsRef<GKComponent>> GKComponentSystem<ComponentType> {
124 extern_methods!(
125 #[unsafe(method(componentClass))]
128 #[unsafe(method_family = none)]
129 pub unsafe fn componentClass(&self) -> &'static AnyClass;
130
131 #[unsafe(method(components))]
133 #[unsafe(method_family = none)]
134 pub unsafe fn components(&self) -> Retained<NSArray<ComponentType>>;
135
136 #[unsafe(method(objectAtIndexedSubscript:))]
138 #[unsafe(method_family = none)]
139 pub unsafe fn objectAtIndexedSubscript(&self, idx: NSUInteger) -> Retained<ComponentType>;
140
141 #[unsafe(method(initWithComponentClass:))]
147 #[unsafe(method_family = init)]
148 pub unsafe fn initWithComponentClass(
149 this: Allocated<Self>,
150 cls: &AnyClass,
151 ) -> Retained<Self>;
152
153 #[unsafe(method(addComponent:))]
159 #[unsafe(method_family = none)]
160 pub unsafe fn addComponent(&self, component: &ComponentType);
161
162 #[cfg(feature = "GKEntity")]
163 #[unsafe(method(addComponentWithEntity:))]
173 #[unsafe(method_family = none)]
174 pub unsafe fn addComponentWithEntity(&self, entity: &GKEntity);
175
176 #[cfg(feature = "GKEntity")]
177 #[unsafe(method(removeComponentWithEntity:))]
184 #[unsafe(method_family = none)]
185 pub unsafe fn removeComponentWithEntity(&self, entity: &GKEntity);
186
187 #[unsafe(method(removeComponent:))]
191 #[unsafe(method_family = none)]
192 pub unsafe fn removeComponent(&self, component: &ComponentType);
193
194 #[unsafe(method(updateWithDeltaTime:))]
197 #[unsafe(method_family = none)]
198 pub unsafe fn updateWithDeltaTime(&self, seconds: NSTimeInterval);
199
200 #[unsafe(method(classForGenericArgumentAtIndex:))]
202 #[unsafe(method_family = none)]
203 pub unsafe fn classForGenericArgumentAtIndex(&self, index: NSUInteger)
204 -> &'static AnyClass;
205 );
206}
207
208impl<ComponentType: Message + AsRef<GKComponent>> GKComponentSystem<ComponentType> {
210 extern_methods!(
211 #[unsafe(method(init))]
212 #[unsafe(method_family = init)]
213 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
214
215 #[unsafe(method(new))]
216 #[unsafe(method_family = new)]
217 pub unsafe fn new() -> Retained<Self>;
218 );
219}