Просмотр исходного кода

Fix scissor on macos (#2170)

* Expose GetRenderWidth and GetRenderHeight functions

* Fix scissor on macos

* Fix typo
pull/2171/head
Arnaud Valensi 3 лет назад
committed by GitHub
Родитель
Сommit
b248a00c90
Не найден GPG ключ соответствующий данной подписи Идентификатор GPG ключа: 4AEE18F83AFDEB23
2 измененных файлов: 11 добавлений и 0 удалений
  1. +2
    -0
      src/raylib.h
  2. +9
    -0
      src/rcore.c

+ 2
- 0
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

+ 9
- 0
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

Загрузка…
Отмена
Сохранить