Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cocostudio on mac: issue with percentage positions and sizes (c++) #14749

Closed
Shulepov opened this issue Dec 19, 2015 · 3 comments
Closed

cocostudio on mac: issue with percentage positions and sizes (c++) #14749

Shulepov opened this issue Dec 19, 2015 · 3 comments

Comments

@Shulepov
Copy link
Contributor

When positions or sizes set to percentages them are rounded down.

E.g. if it set to 250% it will be rounded to 200%, if it set to 75% - it will be rounded to 0%.

http://discuss.cocos2d-x.org/t/cocostudio-percentage-positions-and-sizes-issue/25739

cocostudio 2.3.3
cocos2d-x 3.9
mac os x

@Shulepov
Copy link
Contributor Author

I have create sample item (just a layer with panel inside):
thats an original item.csd
and that a published one - item.csb

Layer has size 120x120.
Panel has percentage size (50%, 100%).

if you just add item.csb onto the screen - it will appear (i guess it has some initial attributes setup);
But if you'l try to change it's size and perform layout - it will disappear.

By performing next code we can get a panel itself and it's layout:

Widget *panel = rootNode->getChildByName<Widget *>("Panel_1");
LayoutComponent *component = dynamic_cast<LayoutComponent *>(panel->getComponent("__ui_layout"));

But in layout component:

_percentWidth = 0 //instead of 0.5
_usingPercentWidth = true
_percentHeight = 1
_usingPercentHeight = true

So if not use dynamic layout - all works well. But if try to change size and perform doLayout - all is broken.

@Shulepov
Copy link
Contributor Author

Also noticed weird behavior for MainScene that created when starting new project in cocostudio:

  • if run this project without any modifications - "HelloWorld" sprite will appear as intended;
  • but if publish this project - and run again - sprite will have anchor point (0, 0) at runtime instead of (0.5, 0.5) that is specified in cocostudio.

So there is possibly some issue with Cocostudio for mac, as default scene bundled with new project parsed and presented by cocos2d-x successfully.

@Shulepov
Copy link
Contributor Author

Actually issue was in system language and in used delimiter for numbers. It works incorrectly when used 'comma' as delimiter. After changing system language to english it started to work correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant