mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-22 20:21:26 +00:00
- On Windows resizing a window just renders the image to the size of the window, so lets do the same for SDL (makes mouse coordinate scaling easier).
This commit is contained in:
parent
4d082d93cd
commit
354ec022b3
1 changed files with 9 additions and 7 deletions
|
@ -705,7 +705,7 @@ void SDLFB::ResetSDLRenderer ()
|
||||||
}
|
}
|
||||||
|
|
||||||
// In fullscreen, set logical size according to animorphic ratio.
|
// In fullscreen, set logical size according to animorphic ratio.
|
||||||
// Windowed modes are always rendered 1:1.
|
// Windowed modes are rendered to fill the window (usually 1:1)
|
||||||
if (IsFullscreen ())
|
if (IsFullscreen ())
|
||||||
{
|
{
|
||||||
int w, h;
|
int w, h;
|
||||||
|
@ -713,10 +713,6 @@ void SDLFB::ResetSDLRenderer ()
|
||||||
ScaleWithAspect (w, h, Width, Height);
|
ScaleWithAspect (w, h, Width, Height);
|
||||||
SDL_RenderSetLogicalSize (Renderer, w, h);
|
SDL_RenderSetLogicalSize (Renderer, w, h);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
SDL_RenderSetLogicalSize (Renderer, Width, Height);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDLFB::SetVSync (bool vsync)
|
void SDLFB::SetVSync (bool vsync)
|
||||||
|
@ -743,13 +739,14 @@ void SDLFB::SetVSync (bool vsync)
|
||||||
|
|
||||||
void SDLFB::ScaleCoordsFromWindow(SWORD &x, SWORD &y)
|
void SDLFB::ScaleCoordsFromWindow(SWORD &x, SWORD &y)
|
||||||
{
|
{
|
||||||
|
int w, h;
|
||||||
|
SDL_GetWindowSize (Screen, &w, &h);
|
||||||
|
|
||||||
// Detect if we're doing scaling in the Window and adjust the mouse
|
// Detect if we're doing scaling in the Window and adjust the mouse
|
||||||
// coordinates accordingly. This could be more efficent, but I
|
// coordinates accordingly. This could be more efficent, but I
|
||||||
// don't think performance is an issue in the menus.
|
// don't think performance is an issue in the menus.
|
||||||
if(IsFullscreen())
|
if(IsFullscreen())
|
||||||
{
|
{
|
||||||
int w, h;
|
|
||||||
SDL_GetWindowSize (Screen, &w, &h);
|
|
||||||
int realw = w, realh = h;
|
int realw = w, realh = h;
|
||||||
ScaleWithAspect (realw, realh, SCREENWIDTH, SCREENHEIGHT);
|
ScaleWithAspect (realw, realh, SCREENWIDTH, SCREENHEIGHT);
|
||||||
if (realw != SCREENWIDTH || realh != SCREENHEIGHT)
|
if (realw != SCREENWIDTH || realh != SCREENHEIGHT)
|
||||||
|
@ -768,6 +765,11 @@ void SDLFB::ScaleCoordsFromWindow(SWORD &x, SWORD &y)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
x = (SWORD)(x*Width/w);
|
||||||
|
y = (SWORD)(y*Height/h);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ADD_STAT (blit)
|
ADD_STAT (blit)
|
||||||
|
|
Loading…
Reference in a new issue