Просмотр исходного кода

Consider the initial position for the borderless window

Pengfei Li 8 лет назад
Родитель
Сommit
353fc4d7b3

+ 5 - 0
Source/Samples/Sample.inl

@@ -63,6 +63,11 @@ void Sample::Setup()
     engineParameters_[EP_HEADLESS]     = false;
     engineParameters_[EP_SOUND]        = false;
 
+    engineParameters_[EP_BORDERLESS] = true;
+    engineParameters_[EP_WINDOW_POSITION_X] = 100;
+    engineParameters_[EP_WINDOW_POSITION_Y] = 100;
+    engineParameters_[EP_WINDOW_WIDTH] = 500;
+    engineParameters_[EP_WINDOW_HEIGHT] = 500;
     // Construct a search path to find the resource prefix with two entries:
     // The first entry is an empty path which will be substituted with program/bin directory -- this entry is for binary when it is still in build tree
     // The second and third entries are possible relative paths from the installed program/bin directory to the asset directory -- these entries are for binary when it is in the Urho3D SDK installation location

+ 1 - 1
Source/Urho3D/Graphics/Direct3D11/D3D11Graphics.cpp

@@ -2105,7 +2105,7 @@ void Graphics::AdjustWindow(int& newWidth, int& newHeight, bool& newFullscreen,
         }
         else 
         {
-            if (newFullscreen || newBorderless) 
+            if (newFullscreen)
             {
                 // Reposition the window on the specified monitor
                 SDL_Rect display_rect;

+ 1 - 1
Source/Urho3D/Graphics/Direct3D9/D3D9Graphics.cpp

@@ -2352,7 +2352,7 @@ void Graphics::AdjustWindow(int& newWidth, int& newHeight, bool& newFullscreen,
             SDL_GetWindowSize(window_, &newWidth, &newHeight);
         }
         else {
-            if (newFullscreen || newBorderless) 
+            if (newFullscreen) 
             {
                 // Reposition the window on the specified monitor
                 SDL_Rect display_rect;

+ 2 - 2
Source/Urho3D/Graphics/OpenGL/OGLGraphics.cpp

@@ -430,8 +430,8 @@ bool Graphics::SetMode(int width, int height, bool fullscreen, bool borderless,
         SDL_GetDisplayBounds(monitor, &display_rect);
         SDL_SetWindowPosition(window_, display_rect.x, display_rect.y);
 
-        int x = fullscreen || borderless ? display_rect.x : position_.x_;
-        int y = fullscreen || borderless ? display_rect.y : position_.y_;
+        int x = fullscreen ? display_rect.x : position_.x_;
+        int y = fullscreen ? display_rect.y : position_.y_;
 
         unsigned flags = SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN;
         if (fullscreen)