objc2_game_kit/generated/
GKPlayer.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-app-kit")]
7#[cfg(target_os = "macos")]
8use objc2_app_kit::*;
9use objc2_foundation::*;
10
11use crate::*;
12
13extern "C" {
14 pub static GKPlayerIDNoLongerAvailable: &'static NSString;
18}
19
20extern_class!(
21 #[unsafe(super(GKBasePlayer, NSObject))]
23 #[derive(Debug, PartialEq, Eq, Hash)]
24 #[cfg(feature = "GKBasePlayer")]
25 pub struct GKPlayer;
26);
27
28#[cfg(feature = "GKBasePlayer")]
29extern_conformance!(
30 unsafe impl NSCopying for GKPlayer {}
31);
32
33#[cfg(feature = "GKBasePlayer")]
34unsafe impl CopyingHelper for GKPlayer {
35 type Result = Self;
36}
37
38#[cfg(feature = "GKBasePlayer")]
39extern_conformance!(
40 unsafe impl NSObjectProtocol for GKPlayer {}
41);
42
43#[cfg(feature = "GKBasePlayer")]
44impl GKPlayer {
45 extern_methods!(
46 #[unsafe(method(scopedIDsArePersistent))]
48 #[unsafe(method_family = none)]
49 pub unsafe fn scopedIDsArePersistent(&self) -> bool;
50
51 #[unsafe(method(gamePlayerID))]
53 #[unsafe(method_family = none)]
54 pub unsafe fn gamePlayerID(&self) -> Retained<NSString>;
55
56 #[unsafe(method(teamPlayerID))]
58 #[unsafe(method_family = none)]
59 pub unsafe fn teamPlayerID(&self) -> Retained<NSString>;
60
61 #[unsafe(method(displayName))]
63 #[unsafe(method_family = none)]
64 pub unsafe fn displayName(&self) -> Retained<NSString>;
65
66 #[unsafe(method(alias))]
68 #[unsafe(method_family = none)]
69 pub unsafe fn alias(&self) -> Retained<NSString>;
70
71 #[unsafe(method(anonymousGuestPlayerWithIdentifier:))]
72 #[unsafe(method_family = none)]
73 pub unsafe fn anonymousGuestPlayerWithIdentifier(
74 guest_identifier: &NSString,
75 ) -> Retained<Self>;
76
77 #[unsafe(method(guestIdentifier))]
78 #[unsafe(method_family = none)]
79 pub unsafe fn guestIdentifier(&self) -> Option<Retained<NSString>>;
80
81 #[unsafe(method(isInvitable))]
82 #[unsafe(method_family = none)]
83 pub unsafe fn isInvitable(&self) -> bool;
84 );
85}
86
87#[cfg(feature = "GKBasePlayer")]
89impl GKPlayer {
90 extern_methods!(
91 #[unsafe(method(init))]
92 #[unsafe(method_family = init)]
93 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
94
95 #[unsafe(method(new))]
96 #[unsafe(method_family = new)]
97 pub unsafe fn new() -> Retained<Self>;
98 );
99}
100
101#[repr(transparent)]
104#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
105pub struct GKPhotoSize(pub NSInteger);
106impl GKPhotoSize {
107 #[doc(alias = "GKPhotoSizeSmall")]
108 pub const Small: Self = Self(0);
109 #[doc(alias = "GKPhotoSizeNormal")]
110 pub const Normal: Self = Self(1);
111}
112
113unsafe impl Encode for GKPhotoSize {
114 const ENCODING: Encoding = NSInteger::ENCODING;
115}
116
117unsafe impl RefEncode for GKPhotoSize {
118 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
119}
120
121#[cfg(feature = "GKBasePlayer")]
123impl GKPlayer {
124 extern_methods!(
125 #[cfg(all(feature = "block2", feature = "objc2-app-kit"))]
126 #[cfg(target_os = "macos")]
127 #[unsafe(method(loadPhotoForSize:withCompletionHandler:))]
131 #[unsafe(method_family = none)]
132 pub unsafe fn loadPhotoForSize_withCompletionHandler(
133 &self,
134 size: GKPhotoSize,
135 completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSImage, *mut NSError)>>,
136 );
137 );
138}
139
140extern "C" {
141 pub static GKPlayerDidChangeNotificationName: &'static NSNotificationName;
145}
146
147#[cfg(feature = "GKBasePlayer")]
149impl GKPlayer {
150 extern_methods!(
151 #[deprecated]
152 #[unsafe(method(isFriend))]
153 #[unsafe(method_family = none)]
154 pub unsafe fn isFriend(&self) -> bool;
155
156 #[deprecated = "Use ``GKPlayer/gamePlayerID`` or ``GKPlayer/teamPlayerID`` instead."]
157 #[unsafe(method(playerID))]
158 #[unsafe(method_family = none)]
159 pub unsafe fn playerID(&self) -> Retained<NSString>;
160
161 #[cfg(feature = "block2")]
162 #[deprecated]
168 #[unsafe(method(loadPlayersForIdentifiers:withCompletionHandler:))]
169 #[unsafe(method_family = none)]
170 pub unsafe fn loadPlayersForIdentifiers_withCompletionHandler(
171 identifiers: &NSArray<NSString>,
172 completion_handler: Option<
173 &block2::DynBlock<dyn Fn(*mut NSArray<GKPlayer>, *mut NSError)>,
174 >,
175 );
176 );
177}