Still have issue with Mac full screen and controls

Basically, if I launch the game in Windowed mode with
glview = GLViewImpl::create(“Psf2016”);
then I get the little controls in the upper left, but not the green one, so I’m unable to switch to full screen.

So, to get around that, I have an in-game switch, where the user selects “full screen” and then restarts the game. I think use a different call
glview = GLViewImpl::createWithFullScreen(“Psf2016”);

On the good side, this does put the game in full screen, but now it covers everything, including the bottom controls on the desktop, and doesn’t have the little red/yellow/green buttons (or even a menu bar at all).

Any suggestions?

I’m on cocos2d-x 3.10. I’ve updated my Windows version of glfw, but I don’t see how to update the Mac version. Would the updated version offer the full screen toggle?

What about specifying a size? I think AppDelegate.cpp should contain something like.

    auto glview = director->getOpenGLView();
    if(!glview) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_LINUX)
        glview = GLViewImpl::createWithRect("MyTest", cocos2d::Rect(0, 0, designResolutionSize.width, designResolutionSize.height));
#else
        glview = GLViewImpl::create("MyTest");
#endif
        director->setOpenGLView(glview);
    }

I’ve tried to get the actual resolution of my monitor (which I guess I would put in designResolution?), but haven’t had any been able to so far. Thanks.

There is a new resizable flag that you can set true when creating the GLView. YMMV.

// true as last param to allow resize
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_LINUX)
        glview = GLViewImpl::createWithRect("MyTest", cocos2d::Rect(0, 0, designResolutionSize.width, designResolutionSize.height), 1.f, true); 
#else
        glview = GLViewImpl::create("MyTest", true);
#endif

Edit: there’s also this
Cocos2dx 3.4 how to create toggle fullscreen at runtime? (Mac,Win32).

Whoa, I realize it’s early, and I have to do a lot more testing, but … this is working great!!!

I downloaded cocos2d-x 3.13 and created a temporary project, then backed up my existing cocos2d folder and copied the 3.13 folder over in its place (replacing it, not copying over it), and built my Mac version, and … this is beautiful!

I did not update any of the proj.<> folders, and I hope that’s ok. I also haven’t tested this over on my Windows machine yet, or even really tested the iOS version, but this is really exciting! I’m going to break a rule and double post my thanks on that other thread as well, because I think this really rocks!

Thanks, Steve!

1 Like