I want to make my menu/menuscene at the center of the screen? How do I get the related/required informations?
Director
class.
I generally have this data as a variable I can access as follows:
visibleSize = Director::getInstance()->getVisibleSize();
winSize = Director::getInstance()->getWinSize();
visibleOrigin = Director::getInstance()->getVisibleOrigin();
Center would be => Vec2(winSize.width/2.0f, winSize.height/2.0f)
assuming it is set from the global origin. If you use the visibleSize, make sure the origin is taken into account => Vec2(visibleOrigin.x + visibleSize/2.0f, visibleOrigin.y + visibleSize/2.0f)
…
2 Likes
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.