I’m launching the game at 940x690 (or whatever the default resolution) and changing to it 1080p with the following code during the game.
auto glView = Director::getInstance()->getOpenGLView();
glView->setFrameSize(1920, 1080);
glView->setDesignResolutionSize(1920, 1080, ResolutionPolicy::SHOW_ALL);
The problem is that size the scene’s position is still squished into the bottom left of the screen. Destroying the scene and recreating it is what I’ve been doing in the mean time, but if there was a better way to auto adjust the nodes’ position, I’d love to hear it.
I don’t believe there’s a better way, at least not a supported way. I’m not sure if the engine developers should even bother trying to handle changing node positions, scales, and font sizes when a new frame/design size is specified. Maybe the default renderer could just scale up/down the frame buffer until a new scene is loaded.
If anyone knows how other engines handle this that’d be interesting. I believe the new GUI system in Unity does re-layout on window resize, but for the most part games get ugly and this is why games often try to set the resolution only at startup in the setting menu, some require restarts, and unity games can display the resolution upfront in the Unity start game dialog.
Maybe the UI system could be re-built or improved to support “auto” layout where everything is based on relative points or percentages and any change in frame size would cause a re-layout to occur calling callback methods (onLayout or whatever) or signaling an event. Not sure there’s a one-size-fits-all behavior for this functionality?