CocoStudio: Possible to generate dynamic sized scene for cross-platform use?

2.5k Views Asked by At

Is it possible to make a scene, or maybe UI element in cocostudio that scales with the size of the app?

I'm using cocos2d-x and want to make sure I accommodate many screen sizes since the app is cross-platform. As of now, I make my UI elements, add them to a scene in the scene editor, export them and my app picks up the json and imports the scene correctly. That's the good news.

I've also added the options of scaling location and size in cocostudio, to the best of my knowledge as shown in this screen shot.

enter image description here

But, when I change the size of my app the scene I imported does not resize like it should. For example, I created the scene as 640x960 and it always stays that height and width even when the app starts at different.

Anyone successfully gotten cocostudio to export a scene that resizes dynamically?

1

There are 1 best solutions below

2
On

I think I found the answer on this Chinese CocoStudio forum. (Thanks Google translate!)

In the UI editor of CocoStudio you need to have the root node selected. (it's the top node, I just named it root). This is the only node I found that allows you to select absolute or relative positioning.

enter image description here

Select relative positioning under "Child Control Layout" and set the mode to custom under "size and mode" and enable percent.

enter image description here

I also made sure each individual child node was enabled for relative sizing and positioning as mentioned in my original question

EDIT: Important note! The steps above are required, but there is one more thing to note. The field labeled "adapt resolution" must be checked in order for this to work