mirror of
https://github.com/OpenMW/openmw.git
synced 2025-06-20 19:41:36 +00:00
Merge branch 'resize_breaks_window' into 'master'
Resize breaks the sdl window in some cases See merge request OpenMW/openmw!263
This commit is contained in:
commit
5c7ecb865c
3 changed files with 34 additions and 0 deletions
|
@ -42,6 +42,7 @@
|
||||||
Bug #5502: Dead zone for analogue stick movement is too small
|
Bug #5502: Dead zone for analogue stick movement is too small
|
||||||
Bug #5507: Sound volume is not clamped on ingame settings update
|
Bug #5507: Sound volume is not clamped on ingame settings update
|
||||||
Bug #5531: Actors flee using current rotation by axis x
|
Bug #5531: Actors flee using current rotation by axis x
|
||||||
|
Bug #5539: Window resize breaks when going from a lower resolution to full screen resolution
|
||||||
Bug #5548: Certain exhausted topics can be highlighted again even though there's no new dialogue
|
Bug #5548: Certain exhausted topics can be highlighted again even though there's no new dialogue
|
||||||
Feature #390: 3rd person look "over the shoulder"
|
Feature #390: 3rd person look "over the shoulder"
|
||||||
Feature #2386: Distant Statics in the form of Object Paging
|
Feature #2386: Distant Statics in the form of Object Paging
|
||||||
|
|
|
@ -88,7 +88,38 @@ namespace SDLUtil
|
||||||
{
|
{
|
||||||
SDL_SetWindowSize(mWindow, width, height);
|
SDL_SetWindowSize(mWindow, width, height);
|
||||||
SDL_SetWindowBordered(mWindow, windowBorder ? SDL_TRUE : SDL_FALSE);
|
SDL_SetWindowBordered(mWindow, windowBorder ? SDL_TRUE : SDL_FALSE);
|
||||||
|
|
||||||
|
centerWindow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VideoWrapper::centerWindow()
|
||||||
|
{
|
||||||
|
// Resize breaks the sdl window in some cases; see issue: #5539
|
||||||
|
SDL_Rect rect{};
|
||||||
|
int x = 0;
|
||||||
|
int y = 0;
|
||||||
|
int w = 0;
|
||||||
|
int h = 0;
|
||||||
|
auto index = SDL_GetWindowDisplayIndex(mWindow);
|
||||||
|
bool reposition = false;
|
||||||
|
SDL_GetDisplayBounds(index, &rect);
|
||||||
|
SDL_GetWindowSize(mWindow, &w, &h);
|
||||||
|
|
||||||
|
x = rect.x;
|
||||||
|
y = rect.y;
|
||||||
|
|
||||||
|
// Center dimensions that do not fill the screen
|
||||||
|
if (w < rect.w)
|
||||||
|
{
|
||||||
|
x = rect.x + rect.w / 2 - w / 2;
|
||||||
|
}
|
||||||
|
if (h < rect.h)
|
||||||
|
{
|
||||||
|
y = rect.y + rect.h / 2 - h / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_SetWindowPosition(mWindow, x, y);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,8 @@ namespace SDLUtil
|
||||||
|
|
||||||
void setVideoMode(int width, int height, bool fullscreen, bool windowBorder);
|
void setVideoMode(int width, int height, bool fullscreen, bool windowBorder);
|
||||||
|
|
||||||
|
void centerWindow();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SDL_Window* mWindow;
|
SDL_Window* mWindow;
|
||||||
osg::ref_ptr<osgViewer::Viewer> mViewer;
|
osg::ref_ptr<osgViewer::Viewer> mViewer;
|
||||||
|
|
Loading…
Reference in a new issue