setDesignResolutionSize() is being ignored?

Hi all.

I’m using setDesignResolutionSize() in my applicationDidFinishLaunching() function. When I load a UI layout built with CocoStudio everything works correctly on my Win32 build. However on WP8 and on Android the UI isn’t being scaled up. In fact I noticed that whatever values I pass to setDesignResolutionSize(), they seem to have no effect at all except on Win32.

I’m loading the UI layout as follows:

Widget *w = GUIReader::getInstance()->widgetFromJsonFile("UI/TestUI_1.ExportJson");
this->addChild(w);

and my setDesignResolutionSize() method call is:

glview->setDesignResolutionSize(320, 480, ResolutionPolicy::SHOW_ALL);

I’m using Cocos2d-x version 3.2. Anyone knows what might be happening?

1 Like

I use iOS and setDesignResolutionSize() seems to work. Although I’m dong something like:

->setDesignResolutionSize(screenSize.width, screenSize.height, ResolutionPolicy::EXACT_FIT);

My bad. Apparently in the AppDelegate class, on mobile devices the condition below is never true. I was setting the design resolution in there so obviously it was never executed.

if(!glview) {
    ...
}

oh, ha, yup. Glad you are all set.