cocos2dx menu位置计算

cocos2dx menu位置计算,第1张

概述解释: bool CCMenu::initWithArray(CCArray* pArrayOfItems){ if (CCLayer::init()) { // menu in the center of the screen CCSize s = CCDirector::sharedDirector()->getWinSize();

解释:

bool Ccmenu::initWithArray(CCArray* pArrayOfItems){    if (cclayer::init())    {        // menu in the center of the screen        CCSize s = CCDirector::sharedDirector()->getWinSize();        this->ignoreAnchorPointForposition(true);        setAnchorPoint(ccp(0.5f,0.5f));        this->setContentSize(s);        setposition(ccp(s.wIDth/2,s.height/2));                return true;    }    return false;}
menu忽略锚点(相当于以左下角为锚点),而且初始大小为WinSize,位置在屏幕中间。 所以,我们即使设置锚点,也没有用处。但是可以设置位置和大小。 而且不要使用基于menu锚点的坐标计算方法。 总结

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

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

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

原文地址: https://outofmemory.cn/web/1050064.html

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

发表评论

登录后才能评论

评论列表(0条)

保存