cocos2dx3.0 屏幕翻转

需求是,向js提供接口可以程序控制屏幕方向,调整为横屏 或者 竖屏。
jsb反射调用了OC代码,将window进行了翻转

[UIApplication sharedApplication].statusBarOrientation = UIInterfaceOrientationPortrait;
[UIApplication sharedApplication].keyWindow.transform=CGAffineTransformMakeRotation(M_PI_2*3);
CGRect bounds = [UIScreen mainScreen].bounds;
[UIApplication sharedApplication].keyWindow.frame = CGRectMake(bounds.origin.x, bounds.origin.y, bounds.size.height, bounds.size.width);

GLVIEW也跟随进行了翻转

想调整GLView的位置和尺寸,经过几次尝试都失败了。
想仿照cocos2dx2.0 的方案,通过替换不同的RootViewController来实现,在设置 RootViewControllerV.view = nil 时崩溃了。

求解决方案。或者调整glview 位置尺寸的方案

引擎目前不支持动态修改横、竖屏。目前在桌面系统支持改变窗口大小,当窗口变化时会执行以下代码,你可以参考一下:

void GLViewImpl::onGLFWWindowSizeFunCallback(GLFWwindow *window, int width, int height)
{
    if (width && height && _resolutionPolicy != ResolutionPolicy::UNKNOWN)
    {
        Size baseDesignSize = _designResolutionSize;
        ResolutionPolicy baseResolutionPolicy = _resolutionPolicy;

        int frameWidth = width / _frameZoomFactor;
        int frameHeight = height / _frameZoomFactor;
        setFrameSize(frameWidth, frameHeight);
        setDesignResolutionSize(baseDesignSize.width, baseDesignSize.height, baseResolutionPolicy);
        Director::getInstance()->setViewport();
    }
}