objc2_sprite_kit/generated/
SKTileMapNode.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-app-kit")]
7#[cfg(target_os = "macos")]
8use objc2_app_kit::*;
9#[cfg(feature = "objc2-core-foundation")]
10use objc2_core_foundation::*;
11use objc2_foundation::*;
12
13use crate::*;
14
15extern_class!(
16    /// A SpriteKit node used to render a 2D array of textured sprites. Uses SKTileSet to determine what textures it can use to render. Separate tile map nodes can be layered on top of one another to achieve various effects, such as parallax scrolling.
17    ///
18    /// See also [Apple's documentation](https://developer.apple.com/documentation/spritekit/sktilemapnode?language=objc)
19    #[unsafe(super(SKNode, NSResponder, NSObject))]
20    #[derive(Debug, PartialEq, Eq, Hash)]
21    #[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
22    #[cfg(target_os = "macos")]
23    pub struct SKTileMapNode;
24);
25
26#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
27#[cfg(target_os = "macos")]
28extern_conformance!(
29    unsafe impl NSCoding for SKTileMapNode {}
30);
31
32#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
33#[cfg(target_os = "macos")]
34extern_conformance!(
35    unsafe impl NSCopying for SKTileMapNode {}
36);
37
38#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
39#[cfg(target_os = "macos")]
40unsafe impl CopyingHelper for SKTileMapNode {
41    type Result = Self;
42}
43
44#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
45#[cfg(target_os = "macos")]
46extern_conformance!(
47    unsafe impl NSObjectProtocol for SKTileMapNode {}
48);
49
50#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
51#[cfg(target_os = "macos")]
52extern_conformance!(
53    unsafe impl NSSecureCoding for SKTileMapNode {}
54);
55
56#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
57#[cfg(target_os = "macos")]
58impl SKTileMapNode {
59    extern_methods!(
60        #[cfg(all(feature = "SKTileSet", feature = "objc2-core-foundation"))]
61        /// Create a tile map node with the specified tile set and dimensions. The tiles of the map will be empty, equivalent to the nil tile definition/group.
62        ///
63        /// Parameter `tileSet`: the tile set that is used to render the tiles
64        ///
65        /// Parameter `columns`: the number of columns in the map that can hold tiles
66        ///
67        /// Parameter `rows`: the number of rows in the map that can hold tiles
68        ///
69        /// Parameter `tileSize`: the size of each tile in points
70        #[unsafe(method(tileMapNodeWithTileSet:columns:rows:tileSize:))]
71        #[unsafe(method_family = none)]
72        pub unsafe fn tileMapNodeWithTileSet_columns_rows_tileSize(
73            tile_set: &SKTileSet,
74            columns: NSUInteger,
75            rows: NSUInteger,
76            tile_size: CGSize,
77            mtm: MainThreadMarker,
78        ) -> Retained<Self>;
79
80        #[cfg(all(feature = "SKTileSet", feature = "objc2-core-foundation"))]
81        /// Create a tile map node with the specified tile set and dimensions, and fill it with the specified tile group.
82        ///
83        /// Parameter `tileSet`: the tile set that is used to render the tiles
84        ///
85        /// Parameter `columns`: the number of columns in the map that can hold tiles
86        ///
87        /// Parameter `rows`: the number of rows in the map that can hold tiles
88        ///
89        /// Parameter `tileSize`: the size of each tile in points
90        ///
91        /// Parameter `tileGroup`: the tile group we wish to fill the tile map with
92        #[unsafe(method(tileMapNodeWithTileSet:columns:rows:tileSize:fillWithTileGroup:))]
93        #[unsafe(method_family = none)]
94        pub unsafe fn tileMapNodeWithTileSet_columns_rows_tileSize_fillWithTileGroup(
95            tile_set: &SKTileSet,
96            columns: NSUInteger,
97            rows: NSUInteger,
98            tile_size: CGSize,
99            tile_group: &SKTileGroup,
100            mtm: MainThreadMarker,
101        ) -> Retained<Self>;
102
103        #[cfg(all(feature = "SKTileSet", feature = "objc2-core-foundation"))]
104        /// Create a tile map node with the specified tile set and dimensions, and fill it with a specific layout of tile groups that belong to the provided tile set. The tileGroupLayout array should match the dimensions of the tile map (i.e., the number of elements should be equal to columns * rows). Index 0 of the array maps to column 0, row 0 of the tile map. Index 1 is column 1, row 0, and so on, wrapping around to the next row once the index passes the number of columns in the tile map. If the array has fewer elements than the number of tiles in the map, the remaining tiles are initialized with the nil tile group. If the array has more elements than the number of tiles in the map, the extra tile groups are ignored.
105        ///
106        /// Parameter `tileSet`: the tile set that is used to render the tiles
107        ///
108        /// Parameter `columns`: the number of columns in the map that can hold tiles
109        ///
110        /// Parameter `rows`: the number of rows in the map that can hold tiles
111        ///
112        /// Parameter `tileSize`: the size of each tile in points
113        ///
114        /// Parameter `tileGroupLayout`: an array of tile groups that we want to use to fill the tile map
115        #[unsafe(method(tileMapNodeWithTileSet:columns:rows:tileSize:tileGroupLayout:))]
116        #[unsafe(method_family = none)]
117        pub unsafe fn tileMapNodeWithTileSet_columns_rows_tileSize_tileGroupLayout(
118            tile_set: &SKTileSet,
119            columns: NSUInteger,
120            rows: NSUInteger,
121            tile_size: CGSize,
122            tile_group_layout: &NSArray<SKTileGroup>,
123            mtm: MainThreadMarker,
124        ) -> Retained<Self>;
125
126        #[cfg(all(feature = "SKTileSet", feature = "objc2-core-foundation"))]
127        /// Initialize a tile map node with the specified tile set and dimensions. The tiles of the map will be empty, equivalent to the nil tile definition/group.
128        ///
129        /// Parameter `tileSet`: the tile set that is used to render the tiles
130        ///
131        /// Parameter `columns`: the number of columns in the map that can hold tiles
132        ///
133        /// Parameter `rows`: the number of rows in the map that can hold tiles
134        ///
135        /// Parameter `tileSize`: the size of each tile in points
136        #[unsafe(method(initWithTileSet:columns:rows:tileSize:))]
137        #[unsafe(method_family = init)]
138        pub unsafe fn initWithTileSet_columns_rows_tileSize(
139            this: Allocated<Self>,
140            tile_set: &SKTileSet,
141            columns: NSUInteger,
142            rows: NSUInteger,
143            tile_size: CGSize,
144        ) -> Retained<Self>;
145
146        #[cfg(all(feature = "SKTileSet", feature = "objc2-core-foundation"))]
147        /// Initialize a tile map node with the specified tile set and dimensions, and fill it with the specified tile group.
148        ///
149        /// Parameter `tileSet`: the tile set that is used to render the tiles
150        ///
151        /// Parameter `columns`: the number of columns in the map that can hold tiles
152        ///
153        /// Parameter `rows`: the number of rows in the map that can hold tiles
154        ///
155        /// Parameter `tileSize`: the size of each tile in points
156        ///
157        /// Parameter `tileGroup`: the tile group we wish to fill the tile map with
158        #[unsafe(method(initWithTileSet:columns:rows:tileSize:fillWithTileGroup:))]
159        #[unsafe(method_family = init)]
160        pub unsafe fn initWithTileSet_columns_rows_tileSize_fillWithTileGroup(
161            this: Allocated<Self>,
162            tile_set: &SKTileSet,
163            columns: NSUInteger,
164            rows: NSUInteger,
165            tile_size: CGSize,
166            tile_group: &SKTileGroup,
167        ) -> Retained<Self>;
168
169        #[cfg(all(feature = "SKTileSet", feature = "objc2-core-foundation"))]
170        /// Initialize a tile map node with the specified tile set and dimensions, and fill it with a specific layout of tile groups that belong to the provided tile set. The tileGroupLayout array should match the dimensions of the tile map (i.e., the number of elements should be equal to columns * rows). Index 0 of the array maps to column 0, row 0 of the tile map. Index 1 is column 1, row 0, and so on, wrapping around to the next row once the index passes the number of columns in the tile map. If the array has fewer elements than the number of tiles in the map, the remaining tiles are initialized with the nil tile group. If the array has more elements than the number of tiles in the map, the extra tile groups are ignored.
171        ///
172        /// Parameter `tileSet`: the tile set that is used to render the tiles
173        ///
174        /// Parameter `columns`: the number of columns in the map that can hold tiles
175        ///
176        /// Parameter `rows`: the number of rows in the map that can hold tiles
177        ///
178        /// Parameter `tileSize`: the size of each tile in points
179        ///
180        /// Parameter `tileGroupLayout`: an array of tile groups that we want to use to fill the tile map
181        #[unsafe(method(initWithTileSet:columns:rows:tileSize:tileGroupLayout:))]
182        #[unsafe(method_family = init)]
183        pub unsafe fn initWithTileSet_columns_rows_tileSize_tileGroupLayout(
184            this: Allocated<Self>,
185            tile_set: &SKTileSet,
186            columns: NSUInteger,
187            rows: NSUInteger,
188            tile_size: CGSize,
189            tile_group_layout: &NSArray<SKTileGroup>,
190        ) -> Retained<Self>;
191
192        /// The number of columns in the tile map.
193        #[unsafe(method(numberOfColumns))]
194        #[unsafe(method_family = none)]
195        pub unsafe fn numberOfColumns(&self) -> NSUInteger;
196
197        /// Setter for [`numberOfColumns`][Self::numberOfColumns].
198        #[unsafe(method(setNumberOfColumns:))]
199        #[unsafe(method_family = none)]
200        pub unsafe fn setNumberOfColumns(&self, number_of_columns: NSUInteger);
201
202        /// The number of rows in the tile map.
203        #[unsafe(method(numberOfRows))]
204        #[unsafe(method_family = none)]
205        pub unsafe fn numberOfRows(&self) -> NSUInteger;
206
207        /// Setter for [`numberOfRows`][Self::numberOfRows].
208        #[unsafe(method(setNumberOfRows:))]
209        #[unsafe(method_family = none)]
210        pub unsafe fn setNumberOfRows(&self, number_of_rows: NSUInteger);
211
212        #[cfg(feature = "objc2-core-foundation")]
213        /// The size of each tile in the map.
214        #[unsafe(method(tileSize))]
215        #[unsafe(method_family = none)]
216        pub unsafe fn tileSize(&self) -> CGSize;
217
218        #[cfg(feature = "objc2-core-foundation")]
219        /// Setter for [`tileSize`][Self::tileSize].
220        #[unsafe(method(setTileSize:))]
221        #[unsafe(method_family = none)]
222        pub unsafe fn setTileSize(&self, tile_size: CGSize);
223
224        #[cfg(feature = "objc2-core-foundation")]
225        /// The size of the tile map. This is dependent on the tileSize, the number of columns and rows in the map, and the tile set type.
226        #[unsafe(method(mapSize))]
227        #[unsafe(method_family = none)]
228        pub unsafe fn mapSize(&self) -> CGSize;
229
230        #[cfg(feature = "SKTileSet")]
231        /// The tile set being used by this tile map.
232        #[unsafe(method(tileSet))]
233        #[unsafe(method_family = none)]
234        pub unsafe fn tileSet(&self) -> Retained<SKTileSet>;
235
236        #[cfg(feature = "SKTileSet")]
237        /// Setter for [`tileSet`][Self::tileSet].
238        #[unsafe(method(setTileSet:))]
239        #[unsafe(method_family = none)]
240        pub unsafe fn setTileSet(&self, tile_set: &SKTileSet);
241
242        #[cfg(feature = "objc2-core-foundation")]
243        /// Controls the blending between the texture and the tile map color. The valid interval of values is from 0.0 up to and including 1.0. A value above or below that interval is clamped to the minimum (0.0) if below or the maximum (1.0) if above.
244        #[unsafe(method(colorBlendFactor))]
245        #[unsafe(method_family = none)]
246        pub unsafe fn colorBlendFactor(&self) -> CGFloat;
247
248        #[cfg(feature = "objc2-core-foundation")]
249        /// Setter for [`colorBlendFactor`][Self::colorBlendFactor].
250        #[unsafe(method(setColorBlendFactor:))]
251        #[unsafe(method_family = none)]
252        pub unsafe fn setColorBlendFactor(&self, color_blend_factor: CGFloat);
253
254        /// Base color for the tile map (If no texture is present, the color still is drawn).
255        #[unsafe(method(color))]
256        #[unsafe(method_family = none)]
257        pub unsafe fn color(&self) -> Retained<NSColor>;
258
259        /// Setter for [`color`][Self::color].
260        #[unsafe(method(setColor:))]
261        #[unsafe(method_family = none)]
262        pub unsafe fn setColor(&self, color: &NSColor);
263
264        /// Sets the blend mode to use when composing the tile map with the final framebuffer.
265        ///
266        /// See: SKNode.SKBlendMode
267        #[unsafe(method(blendMode))]
268        #[unsafe(method_family = none)]
269        pub unsafe fn blendMode(&self) -> SKBlendMode;
270
271        /// Setter for [`blendMode`][Self::blendMode].
272        #[unsafe(method(setBlendMode:))]
273        #[unsafe(method_family = none)]
274        pub unsafe fn setBlendMode(&self, blend_mode: SKBlendMode);
275
276        #[cfg(feature = "objc2-core-foundation")]
277        /// Used to choose the location in the tile map that maps to its 'position' in the parent's coordinate space. The valid interval for each input is from 0.0 up to and including 1.0.
278        #[unsafe(method(anchorPoint))]
279        #[unsafe(method_family = none)]
280        pub unsafe fn anchorPoint(&self) -> CGPoint;
281
282        #[cfg(feature = "objc2-core-foundation")]
283        /// Setter for [`anchorPoint`][Self::anchorPoint].
284        #[unsafe(method(setAnchorPoint:))]
285        #[unsafe(method_family = none)]
286        pub unsafe fn setAnchorPoint(&self, anchor_point: CGPoint);
287
288        #[cfg(feature = "SKShader")]
289        /// A property that determines whether the tile map is rendered using a custom shader.
290        #[unsafe(method(shader))]
291        #[unsafe(method_family = none)]
292        pub unsafe fn shader(&self) -> Option<Retained<SKShader>>;
293
294        #[cfg(feature = "SKShader")]
295        /// Setter for [`shader`][Self::shader].
296        #[unsafe(method(setShader:))]
297        #[unsafe(method_family = none)]
298        pub unsafe fn setShader(&self, shader: Option<&SKShader>);
299
300        #[cfg(feature = "SKAttribute")]
301        /// Optional dictionary of SKAttributeValues
302        /// Attributes can be used with custom SKShaders.
303        #[unsafe(method(attributeValues))]
304        #[unsafe(method_family = none)]
305        pub unsafe fn attributeValues(&self) -> Retained<NSDictionary<NSString, SKAttributeValue>>;
306
307        #[cfg(feature = "SKAttribute")]
308        /// Setter for [`attributeValues`][Self::attributeValues].
309        #[unsafe(method(setAttributeValues:))]
310        #[unsafe(method_family = none)]
311        pub unsafe fn setAttributeValues(
312            &self,
313            attribute_values: &NSDictionary<NSString, SKAttributeValue>,
314        );
315
316        #[cfg(feature = "SKAttribute")]
317        #[unsafe(method(valueForAttributeNamed:))]
318        #[unsafe(method_family = none)]
319        pub unsafe fn valueForAttributeNamed(
320            &self,
321            key: &NSString,
322        ) -> Option<Retained<SKAttributeValue>>;
323
324        #[cfg(feature = "SKAttribute")]
325        #[unsafe(method(setValue:forAttributeNamed:))]
326        #[unsafe(method_family = none)]
327        pub unsafe fn setValue_forAttributeNamed(&self, value: &SKAttributeValue, key: &NSString);
328
329        /// Bitmask to indicate being lit by a set of lights using overlapping lighting categories.
330        ///
331        /// A light whose category is set to a value that masks to non-zero using this mask will
332        /// apply light to this sprite.
333        ///
334        /// When used together with a normal texture, complex lighting effects can be used.
335        #[unsafe(method(lightingBitMask))]
336        #[unsafe(method_family = none)]
337        pub unsafe fn lightingBitMask(&self) -> u32;
338
339        /// Setter for [`lightingBitMask`][Self::lightingBitMask].
340        #[unsafe(method(setLightingBitMask:))]
341        #[unsafe(method_family = none)]
342        pub unsafe fn setLightingBitMask(&self, lighting_bit_mask: u32);
343
344        #[unsafe(method(enableAutomapping))]
345        #[unsafe(method_family = none)]
346        pub unsafe fn enableAutomapping(&self) -> bool;
347
348        /// Setter for [`enableAutomapping`][Self::enableAutomapping].
349        #[unsafe(method(setEnableAutomapping:))]
350        #[unsafe(method_family = none)]
351        pub unsafe fn setEnableAutomapping(&self, enable_automapping: bool);
352
353        #[cfg(feature = "SKTileSet")]
354        /// Fill the entire tile map with the provided tile group.
355        ///
356        /// Parameter `tileGroup`: the tile group that will be used to fill the map
357        #[unsafe(method(fillWithTileGroup:))]
358        #[unsafe(method_family = none)]
359        pub unsafe fn fillWithTileGroup(&self, tile_group: Option<&SKTileGroup>);
360
361        #[cfg(feature = "SKTileDefinition")]
362        /// Look up the tile definition at the specified tile index.
363        ///
364        /// Parameter `column`: the column index of the tile
365        ///
366        /// Parameter `row`: the row index of the tile
367        #[unsafe(method(tileDefinitionAtColumn:row:))]
368        #[unsafe(method_family = none)]
369        pub unsafe fn tileDefinitionAtColumn_row(
370            &self,
371            column: NSUInteger,
372            row: NSUInteger,
373        ) -> Option<Retained<SKTileDefinition>>;
374
375        #[cfg(feature = "SKTileSet")]
376        /// Look up the tile group at the specified tile index.
377        ///
378        /// Parameter `column`: the column index of the tile
379        ///
380        /// Parameter `row`: the row index of the tile
381        #[unsafe(method(tileGroupAtColumn:row:))]
382        #[unsafe(method_family = none)]
383        pub unsafe fn tileGroupAtColumn_row(
384            &self,
385            column: NSUInteger,
386            row: NSUInteger,
387        ) -> Option<Retained<SKTileGroup>>;
388
389        #[cfg(feature = "SKTileSet")]
390        /// Set the tile group at the specified tile index. When automapping is enabled, the appropriate tile definitions will automatically be selected and placed, possibly modifying neighboring tiles. When automapping is disabled, it will simply place the default center tile definition for the group, and will not modify any of the neihboring tiles.
391        ///
392        /// Parameter `tileGroup`: the tile group we want to place in the map
393        ///
394        /// Parameter `column`: the column index of the tile
395        ///
396        /// Parameter `row`: the row index of the tile
397        #[unsafe(method(setTileGroup:forColumn:row:))]
398        #[unsafe(method_family = none)]
399        pub unsafe fn setTileGroup_forColumn_row(
400            &self,
401            tile_group: Option<&SKTileGroup>,
402            column: NSUInteger,
403            row: NSUInteger,
404        );
405
406        #[cfg(all(feature = "SKTileDefinition", feature = "SKTileSet"))]
407        /// Set the tile group and tile defintion at the specified tile index. When automapping is enabled, it will attempt to resolve the surrounding tiles to allow the specified tile definition to be placed. When automapping is disabled, it will simply place the tile definition and not modify any of the neighboring tiles.
408        ///
409        /// Parameter `tileGroup`: the tile group we want to place in the map
410        ///
411        /// Parameter `tileDefinition`: the tile definition we want to place in the map
412        ///
413        /// Parameter `column`: the column index of the tile
414        ///
415        /// Parameter `row`: the row index of the tile
416        #[unsafe(method(setTileGroup:andTileDefinition:forColumn:row:))]
417        #[unsafe(method_family = none)]
418        pub unsafe fn setTileGroup_andTileDefinition_forColumn_row(
419            &self,
420            tile_group: &SKTileGroup,
421            tile_definition: &SKTileDefinition,
422            column: NSUInteger,
423            row: NSUInteger,
424        );
425
426        #[cfg(feature = "objc2-core-foundation")]
427        /// Returns the column index of the tile that lies under the specified position. Returns NSUIntegerMax if the position does not fall within the tile map.
428        ///
429        /// Parameter `position`: the position we want to check against the tile map
430        #[unsafe(method(tileColumnIndexFromPosition:))]
431        #[unsafe(method_family = none)]
432        pub unsafe fn tileColumnIndexFromPosition(&self, position: CGPoint) -> NSUInteger;
433
434        #[cfg(feature = "objc2-core-foundation")]
435        /// Returns the row index of the tile that lies under the specified position. Returns NSUIntegerMax if the position does not fall within the tile map.
436        ///
437        /// Parameter `position`: the position we want to check against the tile map
438        #[unsafe(method(tileRowIndexFromPosition:))]
439        #[unsafe(method_family = none)]
440        pub unsafe fn tileRowIndexFromPosition(&self, position: CGPoint) -> NSUInteger;
441
442        #[cfg(feature = "objc2-core-foundation")]
443        /// Returns the position of the center of the tile at the specified column and row.
444        ///
445        /// Parameter `column`: the column index of the tile
446        ///
447        /// Parameter `row`: the row index of the tile
448        #[unsafe(method(centerOfTileAtColumn:row:))]
449        #[unsafe(method_family = none)]
450        pub unsafe fn centerOfTileAtColumn_row(
451            &self,
452            column: NSUInteger,
453            row: NSUInteger,
454        ) -> CGPoint;
455    );
456}
457
458/// Methods declared on superclass `SKNode`.
459#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
460#[cfg(target_os = "macos")]
461impl SKTileMapNode {
462    extern_methods!(
463        #[unsafe(method(init))]
464        #[unsafe(method_family = init)]
465        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
466
467        /// Support coding and decoding via NSKeyedArchiver.
468        #[unsafe(method(initWithCoder:))]
469        #[unsafe(method_family = init)]
470        pub unsafe fn initWithCoder(
471            this: Allocated<Self>,
472            a_decoder: &NSCoder,
473        ) -> Option<Retained<Self>>;
474
475        #[unsafe(method(node))]
476        #[unsafe(method_family = none)]
477        pub unsafe fn node(mtm: MainThreadMarker) -> Retained<Self>;
478
479        #[unsafe(method(nodeWithFileNamed:))]
480        #[unsafe(method_family = none)]
481        pub unsafe fn nodeWithFileNamed(
482            filename: &NSString,
483            mtm: MainThreadMarker,
484        ) -> Option<Retained<Self>>;
485
486        #[unsafe(method(nodeWithFileNamed:securelyWithClasses:andError:_))]
487        #[unsafe(method_family = none)]
488        pub unsafe fn nodeWithFileNamed_securelyWithClasses_andError(
489            filename: &NSString,
490            classes: &NSSet<AnyClass>,
491            mtm: MainThreadMarker,
492        ) -> Result<Retained<Self>, Retained<NSError>>;
493    );
494}
495
496/// Methods declared on superclass `NSObject`.
497#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
498#[cfg(target_os = "macos")]
499impl SKTileMapNode {
500    extern_methods!(
501        #[unsafe(method(new))]
502        #[unsafe(method_family = new)]
503        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
504    );
505}