diff options
| author | Arnaud Valensi <[email protected]> | 2021-11-25 01:03:20 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-11-25 01:03:20 +0100 |
| commit | b248a00c9043ff08b5bca922ab82080978dd4306 (patch) | |
| tree | 1e89927362dad8421986b43b0444d02d539acf93 /src | |
| parent | e60aa8e9351a3427f1754ef5e83c1f0102223415 (diff) | |
| download | raylib-b248a00c9043ff08b5bca922ab82080978dd4306.tar.gz raylib-b248a00c9043ff08b5bca922ab82080978dd4306.zip | |
Fix scissor on macos (#2170)
* Expose GetRenderWidth and GetRenderHeight functions
* Fix scissor on macos
* Fix typo
Diffstat (limited to 'src')
| -rw-r--r-- | src/raylib.h | 2 | ||||
| -rw-r--r-- | src/rcore.c | 9 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/raylib.h b/src/raylib.h index 7f05445b..8f01e483 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -928,6 +928,8 @@ RLAPI void SetWindowSize(int width, int height); // Set window RLAPI void *GetWindowHandle(void); // Get native window handle RLAPI int GetScreenWidth(void); // Get current screen width RLAPI int GetScreenHeight(void); // Get current screen height +RLAPI int GetRenderWidth(void); // Get current render width +RLAPI int GetRenderHeight(void); // Get current render height RLAPI int GetMonitorCount(void); // Get number of connected monitors RLAPI int GetCurrentMonitor(void); // Get current connected monitor RLAPI Vector2 GetMonitorPosition(int monitor); // Get specified monitor position diff --git a/src/rcore.c b/src/rcore.c index ec1601ca..58bbbbf4 100644 --- a/src/rcore.c +++ b/src/rcore.c @@ -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 |
