Mac OS Game Center and quit issue

Hi,

  1. I am trying to implement the Game Center API in mac osx >= 10.8 and
    latest sdl2.
    I have alredy done in it iOS successfully like this:------------------------------------------------------------------
    A A A A A A GKLocalPlayer localPlayer = [GKLocalPlayer localPlayer];
    A A A A A A A UIViewController * rootViewController =
    GetSDLViewController(returnTheWindow());
    A A A A A A A if ( ! rootViewController ) {
    A A A A A A A A A A A // handle this error as appropriate
    A A A A A A A } else {
    A A A A A A A A A A A // ios 6.0 and above
    A A A A A A A A A A A [localPlayer
    setAuthenticateHandler:(^(UIViewController
    viewcontroller, NSError
    error) {
    A A A A A A A A A A A A A A A if (!error && viewcontroller)
    A A A A A A A A A A A A A A A {
    A A A A A A A A A A A A A A A A A A A [rootViewController
    presentViewController:viewcontroller animated:YES completion:nil];
    A A A A A A A A A A A A A A A }
    A A A A A A A A A A A A A A A else
    A A A A A A A A A A A A A A A {
    A A A A A A A A A A A A A A A if (localPlayer.isAuthenticated)
    A A A A A A A A A A A A A A A A A A {
    A A A A A A A A A A A A A A A A A A A A A A /
    Perform additional
    tasks for the authenticated player here /
    A A A A A A A A A A A A A A A A A A }
    A A A A A A A A A A A A A A A A A A else
    A A A A A A A A A A A A A A A A A {
    A A A A A A A A A A A A A A A A A A A A A /
    Perform additional
    tasks for the non-authenticated player here /
    A A A A A A A A A A A A A A A A A A }
    A A A A A A A A A A A A A A A }
    A A A A A A A A A A A })];
    A A A A A A A }
    /
    ***********************************************************************************************************
    A * FUNCTIOM: GetSDLViewController
    A ************************************************************************************************************/
    UIViewController * GetSDLViewController(SDL_Window * sdlWindow)
    {
    A A A SDL_SysWMinfo systemWindowInfo;
    A A A SDL_VERSION(&systemWindowInfo.version);
    A A A if ( ! SDL_GetWindowWMInfo(sdlWindow, &systemWindowInfo)) {
    A A A A A A A // consider doing some kind of error handling here
    A A A A A A A NSLog(@“GetSDLViewController error”);
    A A A A A A A return nil;
    A A A }
    A A A UIWindow * appWindow = systemWindowInfo.info.uikit.window;
    A A A UIViewController * rootViewController =
    appWindow.rootViewController;
    A A A return rootViewController;
    }

How can I implement this in Mac OSX that has: NSViewController instead of
UIViewController?

  1. The latest SDL2.0 for MacOSX has a small issue on my 10.8 Lion.
    When the user quits the app the app closes without any error but after it
    close we see the minimize max os effect also.
    this is very irritating. It doesnt have it on my July 13 2013 version of
    SDL2.

Thanks a lot,

Giorgos

This might be overkill, but here’s the Game Center code from Equate, and it
works on both iOS and Mac OS X.

For the bug, can you report it to bugzilla and we’ll take a look?
http://bugzilla.libsdl.org

Thanks!On Thu, Aug 1, 2013 at 7:26 AM, Giorgos Sarris wrote:

Hi,

  1. I am trying to implement the Game Center API in mac osx >= 10.8 and
    latest sdl2.
    I have alredy done in it iOS successfully like this:

    GKLocalPlayer *localPlayer = [GKLocalPlayer localPlayer];
    UIViewController * rootViewController =

GetSDLViewController(returnTheWindow());
if ( ! rootViewController ) {
// handle this error as appropriate
} else {
// ios 6.0 and above
[localPlayer setAuthenticateHandler:(^(UIViewController*
viewcontroller, NSError error) {
if (!error && viewcontroller)
{
[rootViewController
presentViewController:viewcontroller animated:YES completion:nil];
}
else
{
if (localPlayer.isAuthenticated)
{
/
Perform additional tasks for the
authenticated player here /
}
else
{
/
Perform additional tasks for the
non-authenticated player here */
}
}
})];
}

/************************************************************************************************************

  • FUNCTIOM: GetSDLViewController

************************************************************************************************************/
UIViewController * GetSDLViewController(SDL_Window * sdlWindow)
{
SDL_SysWMinfo systemWindowInfo;
SDL_VERSION(&systemWindowInfo.version);
if ( ! SDL_GetWindowWMInfo(sdlWindow, &systemWindowInfo)) {
// consider doing some kind of error handling here
NSLog(@“GetSDLViewController error”);
return nil;
}
UIWindow * appWindow = systemWindowInfo.info.uikit.window;
UIViewController * rootViewController = appWindow.rootViewController;
return rootViewController;
}

How can I implement this in Mac OSX that has: NSViewController instead
of UIViewController?

  1. The latest SDL2.0 for MacOSX has a small issue on my 10.8 Lion.
    When the user quits the app the app closes without any error but after it
    close we see the minimize max os effect also.
    this is very irritating. It doesnt have it on my July 13 2013 version of
    SDL2.

Thanks a lot,

Giorgos


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

-------------- next part --------------
A non-text attachment was scrubbed…
Name: ServiceManager_GameKit.mm
Type: application/octet-stream
Size: 38995 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20130801/3a28fdbf/attachment-0001.obj