diff options
| author | Ray <[email protected]> | 2021-03-20 13:02:44 +0100 |
|---|---|---|
| committer | Ray <[email protected]> | 2021-03-20 13:02:44 +0100 |
| commit | 95282edaf96f5aaf4c4b40e6631edaf9274b8562 (patch) | |
| tree | 169461841e5a19dc6bc24da6bf013582ef855f8f /src/core.c | |
| parent | 75882f32548e564c06a3d14339fabf723601f628 (diff) | |
| download | raylib-95282edaf96f5aaf4c4b40e6631edaf9274b8562.tar.gz raylib-95282edaf96f5aaf4c4b40e6631edaf9274b8562.zip | |
REVIEWED: HighDPI support on macOS retina #1510
Diffstat (limited to 'src/core.c')
| -rw-r--r-- | src/core.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -3300,7 +3300,7 @@ static bool InitGraphicsDevice(int width, int height) // NOTE: This hint only has an effect on platforms where screen coordinates and pixels always map 1:1 such as Windows and X11. // On platforms like macOS the resolution of the framebuffer is changed independently of the window size. glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_TRUE); // Scale content area based on the monitor content scale where window is placed on - #if !defined(__APPLE__) + #if defined(__APPLE__) glfwWindowHint(GLFW_COCOA_RETINA_FRAMEBUFFER, GLFW_TRUE); #endif } @@ -3309,6 +3309,7 @@ static bool InitGraphicsDevice(int width, int height) if (CORE.Window.flags & FLAG_MSAA_4X_HINT) { + // NOTE: MSAA is only enabled for main framebuffer, not user-created FBOs TRACELOG(LOG_INFO, "DISPLAY: Trying to enable MSAA x4"); glfwWindowHint(GLFW_SAMPLES, 4); // Tries to enable multisampling x4 (MSAA), default is 0 } @@ -4067,11 +4068,15 @@ static bool InitGraphicsDevice(int width, int height) #if defined(PLATFORM_DESKTOP) if ((CORE.Window.flags & FLAG_WINDOW_HIGHDPI) > 0) { + // NOTE: On APPLE platforms system should manage window/input scaling and also framebuffer scaling + // Framebuffer scaling should be activated with: glfwWindowHint(GLFW_COCOA_RETINA_FRAMEBUFFER, GLFW_TRUE); + #if !defined(__APPLE__) glfwGetFramebufferSize(CORE.Window.handle, &fbWidth, &fbHeight); // Screen scaling matrix is required in case desired screen area is different than display area CORE.Window.screenScale = MatrixScale((float)fbWidth/CORE.Window.screen.width, (float)fbHeight/CORE.Window.screen.height, 1.0f); - #if !defined(__APPLE__) + + // Mouse input scaling for the new screen size SetMouseScale((float)CORE.Window.screen.width/fbWidth, (float)CORE.Window.screen.height/fbHeight); #endif } |
