MutilResolutionSize Help

Hi,
I’m developing a Game where the design resolution is of 1468x780 and the Resources are also of the same resolution (extracted from a photoshop of 1468x780), that’s why our code is as follows:

cocos2d::Size designResolutionSize = cocos2d::Size(1468, 780);
glview->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, ResolutionPolicy::NO_BORDER);

Do we need to set director->setContentScaleFactor to support multiple resolutions on Android and IPhones?

Thanks.

With your current code the assets will always scale to the device screen size, it will look roughly the same on every device. However you need to take in to account pixels and pixel density. For example let’s imagine you have a device with 480x320 resolution, it won’t have much memory so it would be rediculous load then scale 1468*780 graphics down to a 480x320 device.
This is where setContentScaleFactor comes in, you design multiple sets of assets at various scales. Then when you start the app you select the assets that most closely match the device resolution (there’s a few ways to do this). 3-5 sets is the normal amount. Then you need to calculate the scale factor based on the device size and the assets size, you can look this up in the documentation somewhere.

Alternatively, if your game is relatively lightweight and has only a few assets and doesn’t use much memory you can leave it exactly as it is and use one set of graphics for every device, no need for any scaling then. If you get stuck then ask.

Thanks for your answer!!

With the previous code, assets weren’t scaling to fit the device screen size. I had to add:

float scale = MIN(director->getVisibleSize().height/designResolutionSize.height, director->getVisibleSize().width/designResolutionSize.width);
director->setContentScaleFactor(1/scale);

And now assets are scaled down. Why were’nt before?

On the other hand, I know that having only one set of assets of a bigger size is bad for memory and preformance, but my apk is already 180M; if I add other sets in the Resources they will get copied also in the apk and will increase even more its size!!! How could I handle this??

Thanks!