objc2-gameplay-kit 0.3.2

Bindings to the GameplayKit framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
use objc2_foundation::*;
#[cfg(feature = "objc2-sprite-kit")]
use objc2_sprite_kit::*;

use crate::*;

mod private_SKNodeGameplayKit {
    pub trait Sealed {}
}

/// Category "GameplayKit" on [`SKNode`].
#[doc(alias = "GameplayKit")]
pub unsafe trait SKNodeGameplayKit:
    ClassType + Sized + private_SKNodeGameplayKit::Sealed
{
    extern_methods!(
        #[cfg(all(feature = "GKObstacle", feature = "objc2-sprite-kit"))]
        #[cfg(target_os = "macos")]
        /// Returns an array of GKPolygonObstacles from a group of SKSpriteNode's textures in scene space.
        ///
        ///
        /// See: GKObstacleGraph
        #[unsafe(method(obstaclesFromSpriteTextures:accuracy:))]
        #[unsafe(method_family = none)]
        unsafe fn obstaclesFromSpriteTextures_accuracy(
            sprites: &NSArray<SKNode>,
            accuracy: c_float,
            mtm: MainThreadMarker,
        ) -> Retained<NSArray<GKPolygonObstacle>>;

        #[cfg(all(feature = "GKObstacle", feature = "objc2-sprite-kit"))]
        #[cfg(target_os = "macos")]
        /// Returns an array of GKPolygonObstacles from a group of SKNode's transformed bounds in scene space.
        ///
        ///
        /// See: GKObstacleGraph
        #[unsafe(method(obstaclesFromNodeBounds:))]
        #[unsafe(method_family = none)]
        unsafe fn obstaclesFromNodeBounds(
            nodes: &NSArray<SKNode>,
            mtm: MainThreadMarker,
        ) -> Retained<NSArray<GKPolygonObstacle>>;

        #[cfg(all(feature = "GKObstacle", feature = "objc2-sprite-kit"))]
        #[cfg(target_os = "macos")]
        /// Returns an array of GKPolygonObstacles from a group of SKNode's physics bodies in scene space.
        ///
        ///
        /// See: GKObstacleGraph
        #[unsafe(method(obstaclesFromNodePhysicsBodies:))]
        #[unsafe(method_family = none)]
        unsafe fn obstaclesFromNodePhysicsBodies(
            nodes: &NSArray<SKNode>,
            mtm: MainThreadMarker,
        ) -> Retained<NSArray<GKPolygonObstacle>>;

        #[cfg(feature = "GKEntity")]
        /// The GKEntity associated with the node via a GKSKNodeComponent.
        ///
        ///
        /// See: GKEntity
        #[unsafe(method(entity))]
        #[unsafe(method_family = none)]
        unsafe fn entity(&self) -> Option<Retained<GKEntity>>;

        #[cfg(feature = "GKEntity")]
        /// Setter for [`entity`][Self::entity].
        ///
        /// This is a [weak property][objc2::topics::weak_property].
        #[unsafe(method(setEntity:))]
        #[unsafe(method_family = none)]
        unsafe fn setEntity(&self, entity: Option<&GKEntity>);
    );
}

#[cfg(feature = "objc2-sprite-kit")]
#[cfg(target_os = "macos")]
impl private_SKNodeGameplayKit::Sealed for SKNode {}
#[cfg(feature = "objc2-sprite-kit")]
#[cfg(target_os = "macos")]
unsafe impl SKNodeGameplayKit for SKNode {}

#[cfg(all(feature = "GKScene", feature = "objc2-sprite-kit"))]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl GKSceneRootNodeType for SKScene {}
);

mod private_SKTileMapNodeGameplayKit {
    pub trait Sealed {}
}

/// Category "GameplayKit" on [`SKTileMapNode`].
#[doc(alias = "GameplayKit")]
pub unsafe trait SKTileMapNodeGameplayKit:
    ClassType + Sized + private_SKTileMapNodeGameplayKit::Sealed
{
    extern_methods!(
        #[cfg(all(
            feature = "GKNoiseMap",
            feature = "objc2-core-foundation",
            feature = "objc2-sprite-kit"
        ))]
        #[cfg(target_os = "macos")]
        /// 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
        #[unsafe(method(tileMapNodesWithTileSet:columns:rows:tileSize:fromNoiseMap:tileTypeNoiseMapThresholds:))]
        #[unsafe(method_family = none)]
        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>>;
    );
}

#[cfg(feature = "objc2-sprite-kit")]
#[cfg(target_os = "macos")]
impl private_SKTileMapNodeGameplayKit::Sealed for SKTileMapNode {}
#[cfg(feature = "objc2-sprite-kit")]
#[cfg(target_os = "macos")]
unsafe impl SKTileMapNodeGameplayKit for SKTileMapNode {}

mod private_SKTextureGameplayKit {
    pub trait Sealed {}
}

/// Category "GameplayKit" on [`SKTexture`].
#[doc(alias = "GameplayKit")]
pub unsafe trait SKTextureGameplayKit:
    ClassType + Sized + private_SKTextureGameplayKit::Sealed
{
    extern_methods!(
        #[cfg(feature = "GKNoiseMap")]
        /// Create a texture from a GKNoiseMap.
        ///
        ///
        /// Parameter `noiseMap`: the GKNoiseMap from which to create the texture.
        #[unsafe(method(textureWithNoiseMap:))]
        #[unsafe(method_family = none)]
        unsafe fn textureWithNoiseMap(noise_map: &GKNoiseMap) -> Retained<Self>;
    );
}

#[cfg(feature = "objc2-sprite-kit")]
impl private_SKTextureGameplayKit::Sealed for SKTexture {}
#[cfg(feature = "objc2-sprite-kit")]
unsafe impl SKTextureGameplayKit for SKTexture {}