mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-11 15:22:16 +00:00
Set default window size to 80% of current display in SDL.
Make vid_setsize center window on current display in SDL.
This commit is contained in:
parent
477d2d0389
commit
66f616dc1a
1 changed files with 14 additions and 20 deletions
|
@ -223,11 +223,19 @@ SystemGLFrameBuffer::SystemGLFrameBuffer (void *, bool fullscreen)
|
||||||
{
|
{
|
||||||
static_cast<SDLGLVideo*>(Video)->SetupPixelFormat(false, 0, glvers[glveridx]);
|
static_cast<SDLGLVideo*>(Video)->SetupPixelFormat(false, 0, glvers[glveridx]);
|
||||||
|
|
||||||
Screen = SDL_CreateWindow (caption,
|
SDL_Rect bounds;
|
||||||
SDL_WINDOWPOS_UNDEFINED_DISPLAY(vid_adapter),
|
SDL_GetDisplayBounds(vid_adapter,&bounds);
|
||||||
SDL_WINDOWPOS_UNDEFINED_DISPLAY(vid_adapter),
|
// set default size
|
||||||
vid_defwidth, vid_defheight, (fullscreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0) | SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE
|
if ( win_w <= 0 || win_h <= 0 )
|
||||||
);
|
{
|
||||||
|
win_w = bounds.w * 8 / 10;
|
||||||
|
win_h = bounds.h * 8 / 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
Screen = SDL_CreateWindow(caption,
|
||||||
|
(win_x <= 0) ? SDL_WINDOWPOS_CENTERED_DISPLAY(vid_adapter) : win_x,
|
||||||
|
(win_y <= 0) ? SDL_WINDOWPOS_CENTERED_DISPLAY(vid_adapter) : win_y,
|
||||||
|
win_w, win_h, (fullscreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0) | (win_maximized ? SDL_WINDOW_MAXIMIZED : 0) | SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE);
|
||||||
if (Screen != NULL)
|
if (Screen != NULL)
|
||||||
{
|
{
|
||||||
// enforce minimum size limit
|
// enforce minimum size limit
|
||||||
|
@ -240,20 +248,6 @@ SystemGLFrameBuffer::SystemGLFrameBuffer (void *, bool fullscreen)
|
||||||
m_origGamma[0], m_origGamma[1], m_origGamma[2]
|
m_origGamma[0], m_origGamma[1], m_origGamma[2]
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!fullscreen)
|
|
||||||
{
|
|
||||||
if (win_w >= MIN_WIDTH && win_h >= MIN_HEIGHT)
|
|
||||||
{
|
|
||||||
SDL_SetWindowSize(Screen, win_w, win_h);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (win_x >= 0 && win_y >= 0)
|
|
||||||
{
|
|
||||||
SDL_SetWindowPosition(Screen, win_x, win_y);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -376,7 +370,7 @@ void SystemGLFrameBuffer::SetWindowSize(int w, int h)
|
||||||
{
|
{
|
||||||
win_maximized = false;
|
win_maximized = false;
|
||||||
SDL_SetWindowSize(Screen, w, h);
|
SDL_SetWindowSize(Screen, w, h);
|
||||||
SDL_SetWindowPosition(Screen, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
|
SDL_SetWindowPosition(Screen, SDL_WINDOWPOS_CENTERED_DISPLAY(vid_adapter), SDL_WINDOWPOS_CENTERED_DISPLAY(vid_adapter));
|
||||||
SetSize(GetClientWidth(), GetClientHeight());
|
SetSize(GetClientWidth(), GetClientHeight());
|
||||||
int x, y;
|
int x, y;
|
||||||
SDL_GetWindowPosition(Screen, &x, &y);
|
SDL_GetWindowPosition(Screen, &x, &y);
|
||||||
|
|
Loading…
Reference in a new issue