cocos2dx 3.2 getBoundingBox和getTextureRect

cocos2dx 3.2 getBoundingBox和getTextureRect,第1张

概述Sprite* spTest = Sprite::create("CloseNormal.png");spTest->setPosition(ptCenter);this->addChild(spTest, 1000, 1000);log("111");Rect rect1 = spTest->getBoundingBox();log("<<<%f, %f, %f, %f", rect
Sprite* spTest = Sprite::create("Closenormal.png");spTest->setposition(ptCenter);this->addChild(spTest,1000,1000);log("111");Rect rect1 = spTest->getBoundingBox();log("<<<%f,%f,%f",rect1.origin.x,rect1.origin.y,rect1.size.wIDth,rect1.size.height);Rect rect2 = spTest->getTextureRect();log("<<<%f,rect2.origin.x,rect2.origin.y,rect2.size.wIDth,rect2.size.height);log("222");spTest->setScale(0.2f);Rect rect3 = spTest->getBoundingBox();log("<<<%f,rect3.origin.x,rect3.origin.y,rect3.size.wIDth,rect3.size.height);Rect rect4 = spTest->getTextureRect();log("<<<%f,rect4.origin.x,rect4.origin.y,rect4.size.wIDth,rect4.size.height);/*cocos2d: 111cocos2d: <<<300.000000,460.000000,40.000000,40.000000cocos2d: <<<0.000000,0.000000,40.000000cocos2d: 222cocos2d: <<<316.000000,476.000000,8.000000,8.000000cocos2d: <<<0.000000,40.000000*/

总结 :原始尺寸是40 * 40,发现setScele后,getBoundingBox包围盒子矩形大小变了。

而getTextureRect大小始终是起始点从0,0开始,大小不变。

总结

以上是内存溢出为你收集整理的cocos2dx 3.2 getBoundingBox和getTextureRect全部内容,希望文章能够帮你解决cocos2dx 3.2 getBoundingBox和getTextureRect所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1058910.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-25
下一篇 2022-05-25

发表评论

登录后才能评论

评论列表(0条)

保存