setCapInsets function not works with Scale9Sprite

Hi all,

Currently, I’m facing the problem with scale9path ! I want the result as the image below :
Size : 1363,812
image


I implemented two ways. But It gives the result not as I expected!

Method 01: I loaded .csb file !

cocos2d::CSLoader::getInstance()->createNode(“csb/csb/Layer.csb”);

Method 02: I created Scale9Sprite

	auto popupBackground = Scale9Sprite::createWithSpriteFrameName("popup/popup_bg.png");
	popupBackground->setContentSize(Size(1363, 812));
	popupBackground->setCapInsets(Rect(129, 79, 134, 84));
	popupBackground->setPosition(m_origin + m_visibleSize / 2);
	this->addChild(popupBackground);

Both methods give the same result

Could someone give me the solution for this problem?

Thanks!

t2|392x242

Sorry ! I found the solution, because I use setContentScaleFactor function in AppDelegate ! So the Scale9Path will work incorrectly !

Director::getInstance()->setContentScaleFactor(0.568f)

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.