objc2-game-controller 0.3.2

Bindings to the GameController framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ptr::NonNull;
use objc2::__framework_prelude::*;

use crate::*;

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/gamecontroller/gccontrollerinputstate?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct GCControllerInputState;
);

#[cfg(feature = "GCDevicePhysicalInputState")]
extern_conformance!(
    unsafe impl GCDevicePhysicalInputState for GCControllerInputState {}
);

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

impl GCControllerInputState {
    extern_methods!();
}

/// Methods declared on superclass `NSObject`.
impl GCControllerInputState {
    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!(
    /// [Apple's documentation](https://developer.apple.com/documentation/gamecontroller/gccontrollerliveinput?language=objc)
    #[unsafe(super(GCControllerInputState, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct GCControllerLiveInput;
);

#[cfg(all(
    feature = "GCDevicePhysicalInput",
    feature = "GCDevicePhysicalInputState"
))]
extern_conformance!(
    unsafe impl GCDevicePhysicalInput for GCControllerLiveInput {}
);

#[cfg(feature = "GCDevicePhysicalInputState")]
extern_conformance!(
    unsafe impl GCDevicePhysicalInputState for GCControllerLiveInput {}
);

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

impl GCControllerLiveInput {
    extern_methods!(
        /// Get a view of the controller's input without any system-level control
        /// remapping applied.
        ///
        /// Developers should avoid implementing their own control remapping
        /// functionality and to instead direct users to the system game controller
        /// settings to remap controls.  If you choose to implement your own
        /// control remapping functionality, or if your app streams controller input
        /// to a remote device that implements control remapping functionality, you
        /// should access controller physical input through this interface.
        #[unsafe(method(unmappedInput))]
        #[unsafe(method_family = none)]
        pub unsafe fn unmappedInput(&self) -> Option<Retained<GCControllerLiveInput>>;

        #[unsafe(method(capture))]
        #[unsafe(method_family = none)]
        pub unsafe fn capture(&self) -> Retained<GCControllerInputState>;

        #[cfg(feature = "GCDevicePhysicalInputStateDiff")]
        #[unsafe(method(nextInputState))]
        #[unsafe(method_family = none)]
        pub unsafe fn nextInputState(&self) -> Option<Retained<GCControllerInputState>>;
    );
}

/// Methods declared on superclass `NSObject`.
impl GCControllerLiveInput {
    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>;
    );
}