- Improve letterboxing in fullscreen by taking into account animorphic ratio settings.

- Added more resolutions to the hard coded table (up to 5K).
- Since we're using scaling for fullscreen, we should probably just use the hard coded table for fullscreen resolutions as well.
- Fixed: Resolution menu used fake aspect ratio to determine which aspect to file a resolution under.
- Added a way to use SDL surface blitting instead of accelerated textures.
This commit is contained in:
Braden Obrzut 2014-12-11 01:35:27 -05:00
commit 965d602d26
4 changed files with 155 additions and 64 deletions

View file

@ -18,6 +18,8 @@
#include "templates.h"
#include "s_sound.h"
void ScaleWithAspect (int &w, int &h, int Width, int Height);
static void I_CheckGUICapture ();
static void I_CheckNativeMouse ();
@ -318,6 +320,33 @@ void MessagePump (const SDL_Event &sev)
int x, y;
SDL_GetMouseState (&x, &y);
// 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.
SDL_Window *focus;
if (screen->IsFullscreen() && (focus = SDL_GetMouseFocus ()))
{
int w, h;
SDL_GetWindowSize (focus, &w, &h);
int realw = w, realh = h;
ScaleWithAspect (realw, realh, SCREENWIDTH, SCREENHEIGHT);
if (realw != SCREENWIDTH || realh != SCREENHEIGHT)
{
double xratio = (double)SCREENWIDTH/realw;
double yratio = (double)SCREENHEIGHT/realh;
if (realw < w)
{
x = (x - (w - realw)/2)*xratio;
y *= yratio;
}
else
{
y = (y - (h - realh)/2)*yratio;
x *= xratio;
}
}
}
event.data1 = x;
event.data2 = y;
event.type = EV_GUI_Event;