Fix scissor on macos (#2170)

* Expose GetRenderWidth and GetRenderHeight functions

* Fix scissor on macos

* Fix typo
This commit is contained in:
Arnaud Valensi 2021-11-25 01:03:20 +01:00 committed by GitHub
parent e60aa8e935
commit b248a00c90
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View file

@ -2184,6 +2184,14 @@ void BeginScissorMode(int x, int y, int width, int height)
rlEnableScissorTest();
#if defined(__APPLE__)
Vector2 scale = GetWindowScaleDPI();
rlScissor(
(int)(x*scale.x),
(int)(GetScreenHeight() * scale.y - (((y + height) * scale.y))),
(int)(width*scale.x),
(int)(height*scale.y));
#else
if ((CORE.Window.flags & FLAG_WINDOW_HIGHDPI) > 0)
{
Vector2 scale = GetWindowScaleDPI();
@ -2194,6 +2202,7 @@ void BeginScissorMode(int x, int y, int width, int height)
{
rlScissor(x, CORE.Window.currentFbo.height - (y + height), width, height);
}
#endif
}
// End scissor mode