use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
pub const EAGL_MAJOR_VERSION: c_uint = 1;
pub const EAGL_MINOR_VERSION: c_uint = 0;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct EAGLRenderingAPI(pub NSUInteger);
impl EAGLRenderingAPI {
#[doc(alias = "kEAGLRenderingAPIOpenGLES1")]
pub const OpenGLES1: Self = Self(1);
#[doc(alias = "kEAGLRenderingAPIOpenGLES2")]
pub const OpenGLES2: Self = Self(2);
#[doc(alias = "kEAGLRenderingAPIOpenGLES3")]
pub const OpenGLES3: Self = Self(3);
}
unsafe impl Encode for EAGLRenderingAPI {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for EAGLRenderingAPI {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern "C-unwind" {
pub fn EAGLGetVersion(major: NonNull<c_uint>, minor: NonNull<c_uint>);
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct EAGLSharegroup;
);
extern_conformance!(
unsafe impl NSObjectProtocol for EAGLSharegroup {}
);
impl EAGLSharegroup {
extern_methods!(
#[unsafe(method(debugLabel))]
#[unsafe(method_family = none)]
pub unsafe fn debugLabel(&self) -> Option<Retained<NSString>>;
#[unsafe(method(setDebugLabel:))]
#[unsafe(method_family = none)]
pub unsafe fn setDebugLabel(&self, debug_label: Option<&NSString>);
);
}
impl EAGLSharegroup {
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!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct EAGLContext;
);
extern_conformance!(
unsafe impl NSObjectProtocol for EAGLContext {}
);
impl EAGLContext {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Option<Retained<Self>>;
#[unsafe(method(initWithAPI:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithAPI(
this: Allocated<Self>,
api: EAGLRenderingAPI,
) -> Option<Retained<Self>>;
#[unsafe(method(initWithAPI:sharegroup:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithAPI_sharegroup(
this: Allocated<Self>,
api: EAGLRenderingAPI,
sharegroup: &EAGLSharegroup,
) -> Option<Retained<Self>>;
#[unsafe(method(setCurrentContext:))]
#[unsafe(method_family = none)]
pub unsafe fn setCurrentContext(context: Option<&EAGLContext>) -> bool;
#[unsafe(method(currentContext))]
#[unsafe(method_family = none)]
pub unsafe fn currentContext() -> Option<Retained<EAGLContext>>;
#[unsafe(method(API))]
#[unsafe(method_family = none)]
pub unsafe fn API(&self) -> EAGLRenderingAPI;
#[unsafe(method(sharegroup))]
#[unsafe(method_family = none)]
pub unsafe fn sharegroup(&self) -> Retained<EAGLSharegroup>;
#[unsafe(method(debugLabel))]
#[unsafe(method_family = none)]
pub unsafe fn debugLabel(&self) -> Option<Retained<NSString>>;
#[unsafe(method(setDebugLabel:))]
#[unsafe(method_family = none)]
pub unsafe fn setDebugLabel(&self, debug_label: Option<&NSString>);
#[unsafe(method(isMultiThreaded))]
#[unsafe(method_family = none)]
pub unsafe fn isMultiThreaded(&self) -> bool;
#[unsafe(method(setMultiThreaded:))]
#[unsafe(method_family = none)]
pub unsafe fn setMultiThreaded(&self, multi_threaded: bool);
);
}
impl EAGLContext {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}