mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-22 20:21:26 +00:00
- transform mouse coordinates for menu with fullscreen scale
This commit is contained in:
parent
63a338fd73
commit
497c474fee
1 changed files with 19 additions and 3 deletions
|
@ -191,9 +191,25 @@ class ListMenu : Menu
|
||||||
{
|
{
|
||||||
int sel = -1;
|
int sel = -1;
|
||||||
|
|
||||||
|
int w = desc.DisplayWidth();
|
||||||
|
double sx, sy;
|
||||||
|
if (w == ListMenuDescriptor.CleanScale)
|
||||||
|
{
|
||||||
// convert x/y from screen to virtual coordinates, according to CleanX/Yfac use in DrawTexture
|
// convert x/y from screen to virtual coordinates, according to CleanX/Yfac use in DrawTexture
|
||||||
x = ((x - (screen.GetWidth() / 2)) / CleanXfac) + 160;
|
x = ((x - (screen.GetWidth() / 2)) / CleanXfac) + 160;
|
||||||
y = ((y - (screen.GetHeight() / 2)) / CleanYfac) + 100;
|
y = ((y - (screen.GetHeight() / 2)) / CleanYfac) + 100;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// for fullscreen scale, transform coordinates so that for the given rect the coordinates are within (0, 0, w, h)
|
||||||
|
int h = desc.DisplayHeight();
|
||||||
|
double fx, fy, fw, fh;
|
||||||
|
[fx, fy, fw, fh] = Screen.GetFullscreenRect(w, h, FSMode_ScaleToFit43);
|
||||||
|
|
||||||
|
x = int((x - fx) * w / fw);
|
||||||
|
y = int((y - fy) * h / fh);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (mFocusControl != NULL)
|
if (mFocusControl != NULL)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue