Multi resolution Support for Cocos Studio 2 problem solved! :D

I’m using 3.6 and working in Xcode. And your AppDelegate.cpp is way different from the one I posted on Github :smile:

Thanks @HUTHUT I will try with 3.6 :slight_smile:

Hello,

I am using Cocos2dx 3.9 version.

This is my design resolution:

director->getOpenGLView()->setDesignResolutionSize(1212, 768, ResolutionPolicy::NO_BORDER);

I created .csb file using same design resolution.

Am using below code:

 auto rootNode = CSLoader :: createNode ( "LoginScene.csb" );
    auto size = Director :: getInstance () -> getVisibleSize ();
    rootNode-> setContentSize (size);
    rootNode->setPosition(Vec2(Director :: getInstance () ->getVisibleOrigin().x, Director :: getInstance () ->getVisibleOrigin().y));
    ui :: Helper :: doLayout (rootNode);
    addChild (rootNode);

I have checked in all IOS device and most of the Android device. Game is loading Full screen.

Thanks
Gurudath

2 Likes

@Gurudath in 3.9 they added a new api to simplify this. Use

CSLoader::createNodeWithVisibleSize 

instead of

CSLoader::createNode

Then you dont have to use that fix with setSize and doLayout.

2 Likes

hi @TheCodez

Thanks for info.
I will checkout on Monday.

@TheCodez

Thank you.

is it working guru… ??

@pabitrapadhy

Its working. I have tested. But in our case for Full screen we need to set Position.

rootNode->setPosition(Vec2(Director :: getInstance () ->getVisibleOrigin().x, Director :: getInstance () ->getVisibleOrigin().y));

because of NO_BORDER right… ??
we have to set the origin.

If we set the Design resolution NO_BORDER then we need to set the Origin.

If we set the Design resolution FIXED HEIGHT no need to set the Origin.