Setting CORE.Window.position correctly in InitPlatform() as well.
This also fixes not centering the window correctly when the high dpi flag was enabled.
This commit is contained in:
parent
6cec9a59d6
commit
928dc94504
|
|
@ -1573,11 +1573,16 @@ int InitPlatform(void)
|
||||||
int monitorHeight = 0;
|
int monitorHeight = 0;
|
||||||
glfwGetMonitorWorkarea(monitor, &monitorX, &monitorY, &monitorWidth, &monitorHeight);
|
glfwGetMonitorWorkarea(monitor, &monitorX, &monitorY, &monitorWidth, &monitorHeight);
|
||||||
|
|
||||||
int posX = monitorX + (monitorWidth - (int)CORE.Window.screen.width)/2;
|
// Here CORE.Window.render.width/height should be used instead of CORE.Window.screen.width/height to center the window correctly when the high dpi flag is enabled.
|
||||||
int posY = monitorY + (monitorHeight - (int)CORE.Window.screen.height)/2;
|
int posX = monitorX + (monitorWidth - (int)CORE.Window.render.width)/2;
|
||||||
|
int posY = monitorY + (monitorHeight - (int)CORE.Window.render.height)/2;
|
||||||
if (posX < monitorX) posX = monitorX;
|
if (posX < monitorX) posX = monitorX;
|
||||||
if (posY < monitorY) posY = monitorY;
|
if (posY < monitorY) posY = monitorY;
|
||||||
SetWindowPosition(posX, posY);
|
SetWindowPosition(posX, posY);
|
||||||
|
|
||||||
|
// Update CORE.Window.position here so it is correct from the start
|
||||||
|
CORE.Window.position.x = posX;
|
||||||
|
CORE.Window.position.y = posY;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load OpenGL extensions
|
// Load OpenGL extensions
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user