Considering the window's scale when setting the viewport. (#1659)
This appears to fix the issue with macOS windows opening with the wrong scale.
This commit is contained in:
parent
a76fcaba3e
commit
f4d6bad607
1 changed files with 6 additions and 4 deletions
|
@ -4259,9 +4259,11 @@ static void SetupViewport(int width, int height)
|
||||||
CORE.Window.render.height = height;
|
CORE.Window.render.height = height;
|
||||||
|
|
||||||
// Set viewport width and height
|
// Set viewport width and height
|
||||||
// NOTE: We consider render size and offset in case black bars are required and
|
// NOTE: We consider render size (scaled) and offset in case black bars are required and
|
||||||
// render area does not match full display area (this situation is only applicable on fullscreen mode)
|
// render area does not match full display area (this situation is only applicable on fullscreen mode)
|
||||||
rlViewport(CORE.Window.renderOffset.x/2, CORE.Window.renderOffset.y/2, CORE.Window.render.width - CORE.Window.renderOffset.x, CORE.Window.render.height - CORE.Window.renderOffset.y);
|
float xScale = 1, yScale = 1;
|
||||||
|
glfwGetWindowContentScale(CORE.Window.handle, &xScale, &yScale);
|
||||||
|
rlViewport(CORE.Window.renderOffset.x/2*xScale, CORE.Window.renderOffset.y/2*yScale, (CORE.Window.render.width - CORE.Window.renderOffset.x)*xScale, (CORE.Window.render.height - CORE.Window.renderOffset.y)*yScale);
|
||||||
|
|
||||||
rlMatrixMode(RL_PROJECTION); // Switch to projection matrix
|
rlMatrixMode(RL_PROJECTION); // Switch to projection matrix
|
||||||
rlLoadIdentity(); // Reset current matrix (projection)
|
rlLoadIdentity(); // Reset current matrix (projection)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue