Esempio n. 1
0
    private static void SetResolution(int _nNewWidth, int _nNewHeight, bool bFullScreen)
    {
        //全屏
        if (bFullScreen && isSupportFullScreen)
        {
            Screen.SetResolution(_nNewWidth, _nNewHeight, false);
            screenPosition = new Rect(0, 0, _nNewWidth, _nNewHeight);

            //设定一个新的窗口风格
            GameLogicAPI.SetWindowLong(Initialize.m_WindowHwnd, GWL_STYLE, NEW_LONG);
            GameLogicAPI.SetWindowPos(Initialize.m_WindowHwnd, HWND_NORMAL, (int)screenPosition.x, (int)screenPosition.y, (int)screenPosition.width, (int)screenPosition.height, SWP_SHOWWINDOW);

            GameLogicAPI.SetWindowLong(Initialize.m_WindowHwnd, GWL_STYLE, NEW_LONG);
            GameLogicAPI.SetWindowPos(Initialize.m_WindowHwnd, HWND_NORMAL, (int)screenPosition.x, (int)screenPosition.y, (int)screenPosition.width, (int)screenPosition.height, SWP_SHOWWINDOW);

            GameLogicAPI.SetWindowLong(Initialize.m_WindowHwnd, GWL_STYLE, NEW_LONG);
            GameLogicAPI.SetWindowPos(Initialize.m_WindowHwnd, HWND_NORMAL, (int)screenPosition.x, (int)screenPosition.y, (int)screenPosition.width, (int)screenPosition.height, SWP_SHOWWINDOW);
        }
        //非全屏
        else
        {
            Screen.SetResolution(_nNewWidth, _nNewHeight, false);
            GameLogicAPI.SetWindowPos(Initialize.m_WindowHwnd, HWND_NORMAL, 0, 0, 0, 0, 0x0001 | 0x0002);
            GameLogicAPI.SetWindowPos(Initialize.m_WindowHwnd, HWND_NORMAL, 0, 0, 0, 0, 0x0001 | 0x0002 | 0x0020);
        }

        if (USpeedUI.UISystem.Instance)
        {
            USpeedUI.UISystem.Instance.SetResolution(_nNewWidth, _nNewHeight);
        }
        SceneResInfoManager.API_OnResolutionChanged(_nNewWidth, _nNewHeight);
    }