Fix BeginScissorMode for high DPI. Add comment to set FLAG_WINDOW_HIGHDPI flag.

This commit is contained in:
Luke Krasnoff 2021-11-20 12:32:21 +10:30
parent 4d3c79f91f
commit 28a20218d2
2 changed files with 5 additions and 1 deletions

View File

@ -20,6 +20,9 @@ int main(void)
const int screenWidth = 800; const int screenWidth = 800;
const int screenHeight = 450; const int screenHeight = 450;
// If you have a high DPI screen you'll have to set the High DPI flag.
// SetConfigFlags(FLAG_WINDOW_HIGHDPI);
InitWindow(screenWidth, screenHeight, "raylib [core] example - scissor test"); InitWindow(screenWidth, screenHeight, "raylib [core] example - scissor test");
Rectangle scissorArea = { 0, 0, 300, 300 }; Rectangle scissorArea = { 0, 0, 300, 300 };

View File

@ -2188,7 +2188,8 @@ void BeginScissorMode(int x, int y, int width, int height)
{ {
Vector2 scale = GetWindowScaleDPI(); Vector2 scale = GetWindowScaleDPI();
rlScissor((int)(x*scale.x), (int)(CORE.Window.currentFbo.height - (y + height)*scale.y), (int)(width*scale.x), (int)(height*scale.y)); rlScissor((int)(x*scale.x), (int)(CORE.Window.currentFbo.height - y*scale.y - height/scale.y),
(int)(width*scale.x), (int)(height*scale.y));
} }
else else
{ {