I am a new learner in cococ2d-x game library, and I am learning how to create a simple game in iphone6. The SKD I am using is Xcode, but I have a problem in the screen resolution in the simulator, the situation is as follows:
auto visibleSize = Director::getInstance()->getVisibleSize();
Vec2 origin = Director::getInstance()->getVisibleOrigin();
CCLOG("visibleSize: visibleSize.width=%f, visibleSize.height=%f",visibleSize.width,visibleSize.height);
CCLOG("origin: origin.x=%f, origin.y=%f",origin.x, origin.y);
I use this code to print the visible size and the result is as follows:
visibleSize: visibleSize.width=180.281693,visibleSize.height=320.000000
origin: origin.x=149.859161, origin.y=0.000000
I go to google and found that the size of an iphone 6 is much bigger than the size I get from cocos2d-x code(320 x 480 points) and about the simulator, the tutorial is using iphone retina to show the demo, but I cannot found the iphone Retina simulator in my Xcode, I can only find Ipad Retina, and my simulator version is IOS9.3, this is really annoying because I cannot use the code like
node->setPosition(Point::ZERO);
to set the node to ZERO position, this object will be invisible due to the size problem.
Can someone help me please?
The resolution which you get by calling Director::getInstance()->getVisibleSize();
is not the real device's resolution. It's your Design Resolution
.
Besides, if you want to understand more about cocos2d-x
easy multi-resolution mechanism, check my other answer.
And notice the bottom-left point of the screen is determined by Origin Point
not Point::ZERO
.