[iOS] Need to get the OpenGL view in XCode

Previous topic - Next topic

Dark Schneider

I am working on Game Center for GLBasic 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/ 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.

trucidare

check UIWindow *mow = [[UIApplication sharedApplication]keyWindow]; and from that window on the root view.
MacBook Pro 2,2 GHz Core 2 Duo, 4 GB RAM, 160 GB HDD, 8600M GT
Core i3 - 3,07 GHz, 8 GB Ram, 2.5 TB HDD, Geforce GTX 260+ OC

Dark Schneider

#2
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

Dark Schneider

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.

Dark Schneider

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.