GLBasic forum

Feature request => IDE/Syntax => Topic started by: Dark Schneider on 2011-Aug-03

Title: [iOS] Need to get the OpenGL view in XCode
Post by: Dark Schneider on 2011-Aug-03
I am working on Game Center for GLBasic http://www.glbasic.com/forum/index.php?topic=6680.0 (http://www.glbasic.com/forum/index.php?topic=6680.0), but I can't do the "showLeaderboard" or "showAchievements" functions at this momment because for that we need the current (or root) screen view, we can see it here http://ganbarugames.com/2011/07/cocos2d-game-center/ (http://ganbarugames.com/2011/07/cocos2d-game-center/) in the showLeaderboardForCategory function, as we can see in
Quote
// Create an additional UIViewController to attach the GKLeaderboardViewController to
myViewController = [[UIViewController alloc] init];

// Add the temporary UIViewController to the main OpenGL view
[[[CCDirector sharedDirector] openGLView] addSubview:myViewController.view];


// Tell UIViewController to present the leaderboard
[myViewController presentModalViewController:leaderboardController animated:YES];

Could you add a function for XCode project for this?, or a global variable? I don't matter the way we only need it for that.
Title: Re: [iOS] Need to get the OpenGL view in XCode
Post by: trucidare on 2011-Aug-04
check UIWindow *mow = [[UIApplication sharedApplication]keyWindow]; and from that window on the root view.
Title: Re: [iOS] Need to get the OpenGL view in XCode
Post by: Dark Schneider on 2011-Aug-04
Quote from: trucidare on 2011-Aug-04
check UIWindow *mow = [[UIApplication sharedApplication]keyWindow]; and from that window on the root view.

Well that worked for an App, but when using from GLB it doesn't work.

Look for updated files in the development post http://www.glbasic.com/forum/index.php?topic=6680.msg53974#msg53974 (http://www.glbasic.com/forum/index.php?topic=6680.msg53974#msg53974)
Title: Re: [iOS] Need to get the OpenGL view in XCode
Post by: Dark Schneider on 2011-Aug-04
I think I have solved it, the only thing is that it not hides with animation, it dissaperas instantly, by I think is not much important (player gets the control sooner :D ).

I'll put an updated version soon.
Title: Re: [iOS] Need to get the OpenGL view in XCode
Post by: Dark Schneider on 2011-Aug-12
Bad, the current code doesn't work on iPad, and on iPhone can freeze in some special situation (sometimes holding pressed while table appears). Look at the development post for the attached GCTest project.