It is fine to run the game in EITHER Landscape OR Portrait mode but if you want to support BOTH modes then you endup in trouble.
The system auto-rotates the screen properly, even the nodes are in expected positions.
The problem is with the scene size after the changed orientation. It still maintains the size of the original orientation.
Changing the setContentSize() has effect on placing the node to correct positions but that could be clipped away if out of new view bounderies.
Futhermore, the buttons are positioned as expected but they react on touches in different locations!
It is better to see it in pictures.
Default/start orientation: correct behavior:
All nodes are properly placed and touches work as expected.
Again, changing this->setContentSize() does not solve the problem.
Yet, console shows proper surface size changes. This is not however reflected in scene corrent values.
Yes, this is what I’m doing. But they are not visible in the black area.
They are clipped away.
The native UIVIew which actually shows the cocos2d content has wrong size…
auto director = cocos2d::Director::getInstance();
auto glview = director->getOpenGLView();
glview->setFrameSize(this->width, this->height);
glview->setDesignResolutionSize(this->width, this->height, ResolutionPolicy::SHOW_ALL);
director->drawScene();