Sfoglia il codice sorgente

D3D11: починил баг, когда уже созданное окно нельзя было сделать resizable

https://github.com/urho3d/urho3d/issues/2898
1vanK 3 anni fa
parent
commit
228e3eef0c

+ 1 - 1
Source/Urho3D/Graphics/Graphics.h

@@ -746,7 +746,7 @@ private:
     bool OpenWindow_D3D11(int width, int height, bool resizable, bool borderless);
 
     /// Adjust the window for new resolution and fullscreen mode.
-    void AdjustWindow_D3D11(int& newWidth, int& newHeight, bool& newFullscreen, bool& newBorderless, int& monitor);
+    void AdjustWindow_D3D11(int& newWidth, int& newHeight, bool& newFullscreen, bool& newBorderless, bool& newResizable, int& monitor);
 
     /// Create the Direct3D11 device and swap chain. Requires an open window. Can also be called again to recreate swap chain. Return true on success.
     bool CreateDevice_D3D11(int width, int height);

+ 3 - 2
Source/Urho3D/GraphicsAPI/Direct3D11/D3D11Graphics.cpp

@@ -269,7 +269,7 @@ bool Graphics::SetScreenMode_D3D11(int width, int height, const ScreenModeParams
             return false;
     }
 
-    AdjustWindow_D3D11(width, height, newParams.fullscreen_, newParams.borderless_, newParams.monitor_);
+    AdjustWindow_D3D11(width, height, newParams.fullscreen_, newParams.borderless_, newParams.resizable_, newParams.monitor_);
 
     if (maximize)
     {
@@ -1997,7 +1997,7 @@ bool Graphics::OpenWindow_D3D11(int width, int height, bool resizable, bool bord
     return true;
 }
 
-void Graphics::AdjustWindow_D3D11(int& newWidth, int& newHeight, bool& newFullscreen, bool& newBorderless, int& monitor)
+void Graphics::AdjustWindow_D3D11(int& newWidth, int& newHeight, bool& newFullscreen, bool& newBorderless, bool& newResizable, int& monitor)
 {
     if (!externalWindow_)
     {
@@ -2035,6 +2035,7 @@ void Graphics::AdjustWindow_D3D11(int& newWidth, int& newHeight, bool& newFullsc
         if (!newFullscreen) SDL_HideWindow(window_);
         SDL_SetWindowFullscreen(window_, newFullscreen ? SDL_WINDOW_FULLSCREEN : 0);
         SDL_SetWindowBordered(window_, newBorderless ? SDL_FALSE : SDL_TRUE);
+        SDL_SetWindowResizable(window_, newResizable ? SDL_TRUE : SDL_FALSE);
         if (!newFullscreen) SDL_ShowWindow(window_);
 
         // Resize now if was postponed