Create UI for multiple-resolutions?

Hello,

I have just created UI in cocostudio but I have a small probem because if I try it on different devices with different sizes my ui objects aren’t positioned correctly. I have found here http://stackoverflow.com/questions/22851250/cocostudio-possible-to-generate-dynamic-sized-scene-for-cross-platform-use that I can make it dynamic resolution but it doesn’t work on positioning and label size. Does anybody know how can make it also apply to positioning and label size?

Cheers EgorDm.

Multi-res positioning should be supported in next version :smile:

I have come across this problem too. You can set it in cocostudio by choosing root node and ticking “Adaptive resolution” . It won’t work for animation though unless you do some changes in cocostudio parser
However in my opinion it is better to create ui in one “fixed” resolution (but use everywhere “percent” for position and scaling) and then in your code use setDesignResolutionSize(yourCocostudioResSize). It will also work If you have few versions of textures for high-end and low-end devices since it is all “percent” scaling and positiong so cocos2d-x will interpert this files as “create image in position 20% of the screen width and 50% height with size of 50% of the screen”, so no matter what size your resource is it will fit perfectly. Take a look at Multi-Screen Support for different Android Screens this thread (esoecially “wiwing” post) for more info

1 Like