Unscale the window size on resize if we are doing automatic HighDPI scaling.
This commit is contained in:
parent
b80250bee4
commit
4bed3741c1
3 changed files with 31 additions and 5 deletions
|
@ -1753,8 +1753,14 @@ static void WindowSizeCallback(GLFWwindow *window, int width, int height)
|
|||
|
||||
if (IsWindowFullscreen()) return;
|
||||
|
||||
// Set current screen size
|
||||
// if we are doing automatic DPI scaling, then the "screen" size is divided by the window scale
|
||||
if (IsWindowState(FLAG_WINDOW_HIGHDPI))
|
||||
{
|
||||
width = (int)(width / GetWindowScaleDPI().x);
|
||||
height = (int)(height / GetWindowScaleDPI().y);
|
||||
}
|
||||
|
||||
// Set current screen size
|
||||
CORE.Window.screen.width = width;
|
||||
CORE.Window.screen.height = height;
|
||||
|
||||
|
|
|
@ -1033,8 +1033,19 @@ void PollInputEvents(void)
|
|||
case RGFW_windowResized:
|
||||
{
|
||||
SetupViewport(platform.window->r.w, platform.window->r.h);
|
||||
CORE.Window.screen.width = platform.window->r.w;
|
||||
CORE.Window.screen.height = platform.window->r.h;
|
||||
|
||||
// if we are doing automatic DPI scaling, then the "screen" size is divided by the window scale
|
||||
if (IsWindowState(FLAG_WINDOW_HIGHDPI))
|
||||
{
|
||||
CORE.Window.screen.width = (int)(platform.window->r.w / GetWindowScaleDPI().x);
|
||||
CORE.Window.screen.height = (int)(platform.window->r.h / GetWindowScaleDPI().y);
|
||||
}
|
||||
else
|
||||
{
|
||||
CORE.Window.screen.width = platform.window->r.w;
|
||||
CORE.Window.screen.height = platform.window->r.h;
|
||||
}
|
||||
|
||||
CORE.Window.currentFbo.width = platform.window->r.w;
|
||||
CORE.Window.currentFbo.height = platform.window->r.h;
|
||||
CORE.Window.resizedLastFrame = true;
|
||||
|
|
|
@ -1451,8 +1451,17 @@ void PollInputEvents(void)
|
|||
const int width = event.window.data1;
|
||||
const int height = event.window.data2;
|
||||
SetupViewport(width, height);
|
||||
CORE.Window.screen.width = width;
|
||||
CORE.Window.screen.height = height;
|
||||
// if we are doing automatic DPI scaling, then the "screen" size is divided by the window scale
|
||||
if (IsWindowState(FLAG_WINDOW_HIGHDPI))
|
||||
{
|
||||
CORE.Window.screen.width = (int)(width / GetWindowScaleDPI().x);
|
||||
CORE.Window.screen.height = (int)(height / GetWindowScaleDPI().y);
|
||||
}
|
||||
else
|
||||
{
|
||||
CORE.Window.screen.width = width;
|
||||
CORE.Window.screen.height = height;
|
||||
}
|
||||
CORE.Window.currentFbo.width = width;
|
||||
CORE.Window.currentFbo.height = height;
|
||||
CORE.Window.resizedLastFrame = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue