cocos2d x - Cocos 2d-x 3.0 - How does scale9 stretching work? -
in cocos2d.x 3.0, ui::button class has setscale9enabled method. doesn't seem work line old scale9sprite in extensions.
i tried calling setscale9enabled(true) end image divided in 4, corners in wrong places. bottom right corner of source image in top left of rendered image, example.
i tried calling setcapinsetsnormalrenderer(rect) various rects (size of image, middle third, etc) results unpredictable.
don't forget set size of button.
i tried image (160x160 pixel):
with code:
ui::button *button = ui::button::create(); button->setscale9enabled(true); button->loadtexturenormal("button.png"); button->setsize(size(300,160)); button->settitletext("button"); button->setposition(point(200,200)); addchild(button);
and working expected.
Comments
Post a Comment