objc2-sprite-kit 0.3.2

Bindings to the SpriteKit 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-app-kit")]
#[cfg(target_os = "macos")]
use objc2_app_kit::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
use objc2_foundation::*;

use crate::*;

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/spritekit/sklightnode?language=objc)
    #[unsafe(super(SKNode, NSResponder, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
    #[cfg(target_os = "macos")]
    pub struct SKLightNode;
);

#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSCoding for SKLightNode {}
);

#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSCopying for SKLightNode {}
);

#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
#[cfg(target_os = "macos")]
unsafe impl CopyingHelper for SKLightNode {
    type Result = Self;
}

#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSObjectProtocol for SKLightNode {}
);

#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSSecureCoding for SKLightNode {}
);

#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
#[cfg(target_os = "macos")]
impl SKLightNode {
    extern_methods!(
        /// Enables or disables lighting contribution from this light node.
        ///
        /// Set to YES; sprites using this light will be lit with the ambient color and
        /// the light color, with a falloff in intensity according to the falloff property.
        ///
        /// Set to NO; this light does not contribute any lighting.
        ///
        /// If no lights are active on a sprite it will be drawn normally, as if not lit.
        ///
        /// The default value is YES.
        ///
        ///
        /// See: lightColor
        ///
        /// See: falloff
        ///
        /// See: categoryBitMask
        #[unsafe(method(isEnabled))]
        #[unsafe(method_family = none)]
        pub unsafe fn isEnabled(&self) -> bool;

        /// Setter for [`isEnabled`][Self::isEnabled].
        #[unsafe(method(setEnabled:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setEnabled(&self, enabled: bool);

        /// Diffuse and Specular color of the light source, defaults to opaque white.
        ///
        /// The alpha component of the color is ignored.
        ///
        /// If using shaders bind a uniform to this property to use scene based custom lighting.
        ///
        ///
        /// See: SKUniform
        ///
        /// See: falloff
        #[unsafe(method(lightColor))]
        #[unsafe(method_family = none)]
        pub unsafe fn lightColor(&self) -> Retained<NSColor>;

        /// Setter for [`lightColor`][Self::lightColor].
        #[unsafe(method(setLightColor:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setLightColor(&self, light_color: &NSColor);

        /// Ambient color of the light source, defaults to black.
        ///
        /// If you had only a single light in the scene with an ambient color
        /// of opaque white and a light color of black,
        /// it would appear as if the scene was rendered without lighting.
        ///
        /// The alpha component of the color is ignored. The color is not
        /// affected by falloff or surface normals.
        ///
        ///
        /// See: lightColor
        #[unsafe(method(ambientColor))]
        #[unsafe(method_family = none)]
        pub unsafe fn ambientColor(&self) -> Retained<NSColor>;

        /// Setter for [`ambientColor`][Self::ambientColor].
        #[unsafe(method(setAmbientColor:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setAmbientColor(&self, ambient_color: &NSColor);

        /// Color of the shadow casted on occluded objects, defaults to half opacity black.
        ///
        /// The alpha component of the color is used for blending with the regions that are in shadow.
        ///
        ///
        /// See: SKSpriteNode.shadowCastBitMask
        ///
        /// See: SKSpriteNode.shadowedBitMask
        #[unsafe(method(shadowColor))]
        #[unsafe(method_family = none)]
        pub unsafe fn shadowColor(&self) -> Retained<NSColor>;

        /// Setter for [`shadowColor`][Self::shadowColor].
        #[unsafe(method(setShadowColor:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setShadowColor(&self, shadow_color: &NSColor);

        #[cfg(feature = "objc2-core-foundation")]
        /// Falloff in intensity of the light over distance, defaults to 1.
        /// The falloff does not affect the ambient color nor the shadow color.
        ///
        ///
        /// See: lightColor
        #[unsafe(method(falloff))]
        #[unsafe(method_family = none)]
        pub unsafe fn falloff(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`falloff`][Self::falloff].
        #[unsafe(method(setFalloff:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setFalloff(&self, falloff: CGFloat);

        /// The category of the light, which determines the group(s) a light belongs to.
        /// Any node that has its corresponding light and shadow bitmasks set to an overlapping value
        /// will be lit, shadow casting or shadowed by this light.
        ///
        ///
        /// See: SKSpriteNode.lightingBitMask
        ///
        /// See: SKSpriteNode.shadowCastBitMask
        ///
        /// See: SKSpriteNode.shadowedBitMask
        #[unsafe(method(categoryBitMask))]
        #[unsafe(method_family = none)]
        pub unsafe fn categoryBitMask(&self) -> u32;

        /// Setter for [`categoryBitMask`][Self::categoryBitMask].
        #[unsafe(method(setCategoryBitMask:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setCategoryBitMask(&self, category_bit_mask: u32);
    );
}

/// Methods declared on superclass `SKNode`.
#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
#[cfg(target_os = "macos")]
impl SKLightNode {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        /// Support coding and decoding via NSKeyedArchiver.
        ///
        /// # Safety
        ///
        /// `a_decoder` possibly has further requirements.
        #[unsafe(method(initWithCoder:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCoder(
            this: Allocated<Self>,
            a_decoder: &NSCoder,
        ) -> Option<Retained<Self>>;

        #[unsafe(method(node))]
        #[unsafe(method_family = none)]
        pub unsafe fn node(mtm: MainThreadMarker) -> Retained<Self>;

        #[unsafe(method(nodeWithFileNamed:))]
        #[unsafe(method_family = none)]
        pub unsafe fn nodeWithFileNamed(
            filename: &NSString,
            mtm: MainThreadMarker,
        ) -> Option<Retained<Self>>;

        /// # Safety
        ///
        /// `classes` generic probably has further requirements.
        #[unsafe(method(nodeWithFileNamed:securelyWithClasses:andError:_))]
        #[unsafe(method_family = none)]
        pub unsafe fn nodeWithFileNamed_securelyWithClasses_andError(
            filename: &NSString,
            classes: &NSSet<AnyClass>,
            mtm: MainThreadMarker,
        ) -> Result<Retained<Self>, Retained<NSError>>;
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
#[cfg(target_os = "macos")]
impl SKLightNode {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
    );
}