use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
use objc2_foundation::*;
use crate::*;
extern_protocol!(
pub unsafe trait SKPhysicsContactDelegate: NSObjectProtocol {
#[cfg(feature = "SKPhysicsContact")]
#[optional]
#[unsafe(method(didBeginContact:))]
#[unsafe(method_family = none)]
unsafe fn didBeginContact(&self, contact: &SKPhysicsContact);
#[cfg(feature = "SKPhysicsContact")]
#[optional]
#[unsafe(method(didEndContact:))]
#[unsafe(method_family = none)]
unsafe fn didEndContact(&self, contact: &SKPhysicsContact);
}
);
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct SKPhysicsWorld;
);
extern_conformance!(
unsafe impl NSCoding for SKPhysicsWorld {}
);
extern_conformance!(
unsafe impl NSObjectProtocol for SKPhysicsWorld {}
);
extern_conformance!(
unsafe impl NSSecureCoding for SKPhysicsWorld {}
);
impl SKPhysicsWorld {
extern_methods!(
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(gravity))]
#[unsafe(method_family = none)]
pub unsafe fn gravity(&self) -> CGVector;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setGravity:))]
#[unsafe(method_family = none)]
pub unsafe fn setGravity(&self, gravity: CGVector);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(speed))]
#[unsafe(method_family = none)]
pub unsafe fn speed(&self) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setSpeed:))]
#[unsafe(method_family = none)]
pub unsafe fn setSpeed(&self, speed: CGFloat);
#[unsafe(method(contactDelegate))]
#[unsafe(method_family = none)]
pub unsafe fn contactDelegate(
&self,
) -> Option<Retained<ProtocolObject<dyn SKPhysicsContactDelegate>>>;
#[unsafe(method(setContactDelegate:))]
#[unsafe(method_family = none)]
pub unsafe fn setContactDelegate(
&self,
contact_delegate: Option<&ProtocolObject<dyn SKPhysicsContactDelegate>>,
);
#[cfg(feature = "SKPhysicsJoint")]
#[unsafe(method(addJoint:))]
#[unsafe(method_family = none)]
pub unsafe fn addJoint(&self, joint: &SKPhysicsJoint);
#[cfg(feature = "SKPhysicsJoint")]
#[unsafe(method(removeJoint:))]
#[unsafe(method_family = none)]
pub unsafe fn removeJoint(&self, joint: &SKPhysicsJoint);
#[unsafe(method(removeAllJoints))]
#[unsafe(method_family = none)]
pub unsafe fn removeAllJoints(&self);
#[cfg(all(feature = "SKPhysicsBody", feature = "objc2-core-foundation"))]
#[unsafe(method(bodyAtPoint:))]
#[unsafe(method_family = none)]
pub unsafe fn bodyAtPoint(&self, point: CGPoint) -> Option<Retained<SKPhysicsBody>>;
#[cfg(all(feature = "SKPhysicsBody", feature = "objc2-core-foundation"))]
#[unsafe(method(bodyInRect:))]
#[unsafe(method_family = none)]
pub unsafe fn bodyInRect(&self, rect: CGRect) -> Option<Retained<SKPhysicsBody>>;
#[cfg(all(feature = "SKPhysicsBody", feature = "objc2-core-foundation"))]
#[unsafe(method(bodyAlongRayStart:end:))]
#[unsafe(method_family = none)]
pub unsafe fn bodyAlongRayStart_end(
&self,
start: CGPoint,
end: CGPoint,
) -> Option<Retained<SKPhysicsBody>>;
#[cfg(all(
feature = "SKPhysicsBody",
feature = "block2",
feature = "objc2-core-foundation"
))]
#[unsafe(method(enumerateBodiesAtPoint:usingBlock:))]
#[unsafe(method_family = none)]
pub unsafe fn enumerateBodiesAtPoint_usingBlock(
&self,
point: CGPoint,
block: &block2::DynBlock<dyn Fn(NonNull<SKPhysicsBody>, NonNull<Bool>)>,
);
#[cfg(all(
feature = "SKPhysicsBody",
feature = "block2",
feature = "objc2-core-foundation"
))]
#[unsafe(method(enumerateBodiesInRect:usingBlock:))]
#[unsafe(method_family = none)]
pub unsafe fn enumerateBodiesInRect_usingBlock(
&self,
rect: CGRect,
block: &block2::DynBlock<dyn Fn(NonNull<SKPhysicsBody>, NonNull<Bool>)>,
);
#[cfg(all(
feature = "SKPhysicsBody",
feature = "block2",
feature = "objc2-core-foundation"
))]
#[unsafe(method(enumerateBodiesAlongRayStart:end:usingBlock:))]
#[unsafe(method_family = none)]
pub unsafe fn enumerateBodiesAlongRayStart_end_usingBlock(
&self,
start: CGPoint,
end: CGPoint,
block: &block2::DynBlock<
dyn Fn(NonNull<SKPhysicsBody>, CGPoint, CGVector, NonNull<Bool>),
>,
);
);
}
impl SKPhysicsWorld {
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>;
);
}