Update SetupViewport so that it doesn't subtract offset from render dimensions when calling rlViewport (#2064)

Co-authored-by: Michael <michael@cubeofb.org>
This commit is contained in:
michaelfiber 2021-10-17 04:21:51 -04:00 committed by GitHub
parent 99f6707e2c
commit c87e91d27a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4377,9 +4377,9 @@ static void SetupViewport(int width, int height)
#if defined(__APPLE__) #if defined(__APPLE__)
float xScale = 1.0f, yScale = 1.0f; float xScale = 1.0f, yScale = 1.0f;
glfwGetWindowContentScale(CORE.Window.handle, &xScale, &yScale); 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); rlViewport(CORE.Window.renderOffset.x/2*xScale, CORE.Window.renderOffset.y/2*yScale, (CORE.Window.render.width)*xScale, (CORE.Window.render.height)*yScale);
#else #else
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); rlViewport(CORE.Window.renderOffset.x/2, CORE.Window.renderOffset.y/2, CORE.Window.render.width, CORE.Window.render.height);
#endif #endif
rlMatrixMode(RL_PROJECTION); // Switch to projection matrix rlMatrixMode(RL_PROJECTION); // Switch to projection matrix