- 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:
Braden Obrzut 2015-05-20 12:32:17 -04:00
parent 4d082d93cd
commit 354ec022b3
1 changed files with 9 additions and 7 deletions

View File

@ -705,7 +705,7 @@ void SDLFB::ResetSDLRenderer ()
}
// 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 ())
{
int w, h;
@ -713,10 +713,6 @@ void SDLFB::ResetSDLRenderer ()
ScaleWithAspect (w, h, Width, Height);
SDL_RenderSetLogicalSize (Renderer, w, h);
}
else
{
SDL_RenderSetLogicalSize (Renderer, Width, Height);
}
}
void SDLFB::SetVSync (bool vsync)
@ -743,13 +739,14 @@ void SDLFB::SetVSync (bool vsync)
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
// coordinates accordingly. This could be more efficent, but I
// don't think performance is an issue in the menus.
if(IsFullscreen())
{
int w, h;
SDL_GetWindowSize (Screen, &w, &h);
int realw = w, realh = h;
ScaleWithAspect (realw, realh, SCREENWIDTH, 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)