Long live the fullscreen

As you can see from the attached screenshot the TestCpp from the cocos2d-2.0-x-2.0.4 doesn’t correctly scale up the content to fullscreen. Since I have found no solution on the board so far and this is certainly interesting to others as well, what else has to be changed in the applicationDidFinishLaunching-Method to scale the content correctly. I know someone on the board said that desktop is just for debugging, but that would be kinda a waste of this engine in my opinion, so please help.
@

-(void) applicationDidFinishLaunching:(NSNotification *)aNotification
{
// create the window
// note that using NSResizableWindowMask causes the window to be a little
// smaller and therefore ipad graphics are not loaded
NSRect rect = NSMakeRect(200, 200, 1200, 800);
window = [[NSWindow alloc] initWithContentRect:rect
styleMask: ( NSClosableWindowMask | NSTitledWindowMask )
backing:NSBackingStoreBuffered
defer:YES];
// allocate our GL view
//isn’t there already a shared EAGLView?
glView = [[EAGLView alloc] initWithFrame:rect];
[glView initWithFrame:rect];
[glView setFullScreen:YES];
// set window parameters
//[window becomeFirstResponder];
[glView becomeFirstResponder];
//[window setContentView:glView];
//[window setTitle:`“TestCpp”];
//[window makeKeyAndOrderFront:self];
//[window setAcceptsMouseMovedEvents:NO];
cocos2d::CCApplication::sharedApplication()->run();
}

`

What must be changed in order to scale up the content correctly?


Scale.png (156.3 KB)

For all who had the same problem here is the solution kinda:

Replace old applicationDidFinishLaunching with this one:

-(void) applicationDidFinishLaunching:(NSNotification )aNotification
{
NSRect displayRect = frame];
NSWindow
fullScreen = [[CCWindow alloc] initWithFrame:displayRect fullscreen:YES];
glView = [[EAGLView alloc] initWithFrame:displayRect];
[glView initWithFrame:displayRect];
[glView setFullScreen:YES];
[glView becomeFirstResponder];
[fullScreen setContentView:glView];
[fullScreen makeKeyAndOrderFront:self];
[fullScreen makeMainWindow];
cocos2d::CCApplication::sharedApplication()->run();
}

The only weird thing is that the quit button, doesn’t really work anymore, I suspect due to some problems regarding view/superview attachment. Maybe someone is willing to help.

Ok, I know the problem now, I alloced a new CCWindow that isn’t released at the end and thus it stays as a white screen.

NSWindow *fullScreen = [[CCWindow alloc] initWithFrame:displayRect fullscreen:YES];

Since my knowledge of alloc and release is sadly limited I found the following solution:

Go to the CCDirector void CCDirector::purgeDirector()
and add exit(0); right after the following lines:

// delete CCDirector
release();

This is maybe not an ideal solution, but until someone is kind enough to explain how it is done properly, this will do.

Thank’s to all who helped.

Ok, I know the problem now, I alloced a new CCWindow that isn’t released at the end and thus it stays as a white screen.

NSWindow *fullScreen = [[CCWindow alloc] initWithFrame:displayRect fullscreen:YES];

Since my knowledge of alloc and release is sadly limited I found the following solution:

Go to the CCDirector void CCDirector::purgeDirector()
and add exit(0); right after the following lines:

@ delete CCDirector
release();
@
This is maybe not an ideal solution, but until someone is kind enough to explain how it is done properly, this will do.@

Just came across this helpful post. Thanks! Been pulling my hair out trying to get mouse coordinates to line up. The example code that comes with the mac project in 2.2 isn’t working exactly as I had hoped. Even with calling exit(0) on the director being purged it still doesn’t work though. I get that white screen. I’m bumping again to see if you ever figured it out.

AHA! Eureka! The escape key is handled in CCWindow.m under platform/mac. You need to open that up and get rid of the fullscreen toggle if you’re not going to be using that functionality.

I’ve only been working with Objective-C and Cocoa/Mac stuff for the past couple of days, so forgive the ignorance if this is something silly :wink:

@gnelson wrote:

Just came across this helpful post. Thanks! Been pulling my hair out trying to get mouse coordinates to line up. The example code that comes with the mac project in 2.2 isn’t working exactly as I had hoped. Even with calling exit(0) on the director being purged it still doesn’t work though. I get that white screen. I’m bumping again to see if you ever figured it out.

Did you ever figure out how to close that window?