SKTileMapNodeGameplayKit

Trait SKTileMapNodeGameplayKit 

Source
pub unsafe trait SKTileMapNodeGameplayKit:
    ClassType
    + Sized
    + Sealed {
    // Provided method
    unsafe fn tileMapNodesWithTileSet_columns_rows_tileSize_fromNoiseMap_tileTypeNoiseMapThresholds(
        tile_set: &SKTileSet,
        columns: NSUInteger,
        rows: NSUInteger,
        tile_size: CGSize,
        noise_map: &GKNoiseMap,
        thresholds: &NSArray<NSNumber>,
        mtm: MainThreadMarker,
    ) -> Retained<NSArray<SKTileMapNode>> { ... }
}
Available on crate feature SpriteKit_Additions only.
Expand description

Category “GameplayKit” on SKTileMapNode.

Provided Methods§

Source

unsafe fn tileMapNodesWithTileSet_columns_rows_tileSize_fromNoiseMap_tileTypeNoiseMapThresholds( tile_set: &SKTileSet, columns: NSUInteger, rows: NSUInteger, tile_size: CGSize, noise_map: &GKNoiseMap, thresholds: &NSArray<NSNumber>, mtm: MainThreadMarker, ) -> Retained<NSArray<SKTileMapNode>>

Available on crate feature GKNoiseMap and crate feature objc2-core-foundation and crate feature objc2-sprite-kit and macOS only.

Create a set of layered tile map nodes with the specified tile set and dimensions, and fill each layer based on the provided noise map. Each layer will be partially filled with a tile group using values from the noise map that fall below the corresponding values in the thresholds array. The values in the noise map range from -1 to 1, and the provided threshold values are implicitly bounded with the values -1.0 and 1.0. Each threshold value corresponds with a tile group in the tile set, starting with the first tile group in the set. If, for example, we passed in a thresholds array with the values [-0.5, 0.0, 0.5], this method would return an array of four tile maps. The first tile map would contain the first tile group (i.e., tileSet.tileGroups[0]) within tiles that fall between the threshold values -1.0 and -0.5 in the noise map. The second tile map would contain the second tile group (i.e., tileSet.tileGroups[1]) within tiles that fall between the threshold values -0.5 and 0.0 in the noise map. The third tile map would contain the third tile group (i.e., tileSet.tileGroups[2]) within tiles that fall between the threshold values 0.0 and 0.5 in the noise map. And finally, the fourth tile map would contain the fourth tile group (i.e., tileSet.tileGroups[3]) within tiles that fall between the threshold values 0.5 and 1.0.

Parameter tileSet: the tile set that is used to render the tiles

Parameter columns: the number of columns in each map that can hold tiles

Parameter rows: the number of rows in each map that can hold tiles

Parameter tileSize: the size of each tile in points

Parameter noiseMap: the noise map we wish to use to fill each layer

Parameter thresholds: the thresholds for each tile group in the tile set

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl SKTileMapNodeGameplayKit for SKTileMapNode

Available on crate feature objc2-sprite-kit and macOS only.

Implementors§