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::*;
use objc2_foundation::*;

use crate::*;

extern_class!(
    /// Represents an impassible area in 2D space.
    /// Able to be avoided by GKAgent's steering functions
    /// GKGraph can generate navigation graphs from a list of obstacles
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/gameplaykit/gkobstacle?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct GKObstacle;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for GKObstacle {}
);

impl GKObstacle {
    extern_methods!();
}

/// Methods declared on superclass `NSObject`.
impl GKObstacle {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

extern_class!(
    /// An obstacle with an impassible radius
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/gameplaykit/gkcircleobstacle?language=objc)
    #[unsafe(super(GKObstacle, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct GKCircleObstacle;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for GKCircleObstacle {}
);

impl GKCircleObstacle {
    extern_methods!(
        /// Radius of the impassible circle
        #[unsafe(method(radius))]
        #[unsafe(method_family = none)]
        pub unsafe fn radius(&self) -> c_float;

        /// Setter for [`radius`][Self::radius].
        #[unsafe(method(setRadius:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setRadius(&self, radius: c_float);

        #[unsafe(method(obstacleWithRadius:))]
        #[unsafe(method_family = none)]
        pub unsafe fn obstacleWithRadius(radius: c_float) -> Retained<Self>;

        #[unsafe(method(initWithRadius:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithRadius(this: Allocated<Self>, radius: c_float) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
impl GKCircleObstacle {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

extern_class!(
    /// An obstacle with an impassible closed polygon
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/gameplaykit/gkpolygonobstacle?language=objc)
    #[unsafe(super(GKObstacle, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct GKPolygonObstacle;
);

extern_conformance!(
    unsafe impl NSCoding for GKPolygonObstacle {}
);

extern_conformance!(
    unsafe impl NSObjectProtocol for GKPolygonObstacle {}
);

extern_conformance!(
    unsafe impl NSSecureCoding for GKPolygonObstacle {}
);

impl GKPolygonObstacle {
    extern_methods!(
        /// Number of vertices on this polygon
        #[unsafe(method(vertexCount))]
        #[unsafe(method_family = none)]
        pub unsafe fn vertexCount(&self) -> NSUInteger;
    );
}

/// Methods declared on superclass `NSObject`.
impl GKPolygonObstacle {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

extern_class!(
    /// An obstacle with an impassible radius in 3D space
    /// For use with GKAgent3D.  Using this with a GKAgent2D is no different than using GKCircleObstacle.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/gameplaykit/gksphereobstacle?language=objc)
    #[unsafe(super(GKObstacle, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct GKSphereObstacle;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for GKSphereObstacle {}
);

impl GKSphereObstacle {
    extern_methods!(
        /// Radius of the impassible circle
        #[unsafe(method(radius))]
        #[unsafe(method_family = none)]
        pub unsafe fn radius(&self) -> c_float;

        /// Setter for [`radius`][Self::radius].
        #[unsafe(method(setRadius:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setRadius(&self, radius: c_float);

        #[unsafe(method(obstacleWithRadius:))]
        #[unsafe(method_family = none)]
        pub unsafe fn obstacleWithRadius(radius: c_float) -> Retained<Self>;

        #[unsafe(method(initWithRadius:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithRadius(this: Allocated<Self>, radius: c_float) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
impl GKSphereObstacle {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}