@@ -1649,31 +1649,34 @@ int InitPlatform(void)
16491649 TRACELOG (LOG_INFO , "DISPLAY: Trying to enable VSYNC" );
16501650 }
16511651
1652- int fbWidth = CORE .Window .screen .width ;
1653- int fbHeight = CORE .Window .screen .height ;
1654-
16551652 if (FLAG_IS_SET (CORE .Window .flags , FLAG_WINDOW_HIGHDPI ))
16561653 {
1654+ // Set screen size to logical pixel size, considering content scaling
1655+ Vector2 scaleDpi = GetWindowScaleDPI ();
1656+ CORE .Window .render .width = (int )(CORE .Window .screen .width * scaleDpi .x );
1657+ CORE .Window .render .height = (int )(CORE .Window .screen .height * scaleDpi .y );
1658+
16571659 // NOTE: On APPLE platforms system should manage window/input scaling and also framebuffer scaling
16581660 // Framebuffer scaling is activated with: glfwWindowHint(GLFW_SCALE_FRAMEBUFFER, GLFW_TRUE);
1659-
16601661 // Get current framebuffer size, on high-dpi it could be bigger than screen size
1661- glfwGetFramebufferSize (platform .handle , & fbWidth , & fbHeight );
1662+ // glfwGetFramebufferSize(platform.handle, &fbWidth, &fbHeight);
16621663
16631664 // Screen scaling matrix is required in case desired screen area is different from display area
1664- CORE .Window .screenScale = MatrixScale (( float ) fbWidth / CORE . Window . screen . width , ( float ) fbHeight / CORE . Window . screen . height , 1.0f );
1665+ CORE .Window .screenScale = MatrixScale (scaleDpi . x , scaleDpi . y , 1.0f );
16651666#if !defined(__APPLE__ )
16661667 // Mouse input scaling for the new screen size
1667- SetMouseScale (( float ) CORE . Window . screen . width / fbWidth , ( float ) CORE . Window . screen . height / fbHeight );
1668+ SetMouseScale (1.0f / scaleDpi . x , 1.0f / scaleDpi . y );
16681669#endif
1670+ glfwSetWindowSize (platform .handle , CORE .Window .render .width , CORE .Window .render .height );
1671+ }
1672+ else
1673+ {
1674+ CORE .Window .render = CORE .Window .screen ;
1675+ CORE .Window .currentFbo = CORE .Window .render ;
16691676 }
16701677
1671- CORE .Window .render .width = fbWidth ;
1672- CORE .Window .render .height = fbHeight ;
1673- CORE .Window .currentFbo .width = fbWidth ;
1674- CORE .Window .currentFbo .height = fbHeight ;
1675-
1676- TRACELOG (LOG_INFO , "DISPLAY: Device initialized successfully" );
1678+ TRACELOG (LOG_INFO , "DISPLAY: Device initialized successfully %s" ,
1679+ FLAG_IS_SET (CORE .Window .flags , FLAG_WINDOW_HIGHDPI )? "(HighDPI)" : "" );
16771680 TRACELOG (LOG_INFO , " > Display size: %i x %i" , CORE .Window .display .width , CORE .Window .display .height );
16781681 TRACELOG (LOG_INFO , " > Screen size: %i x %i" , CORE .Window .screen .width , CORE .Window .screen .height );
16791682 TRACELOG (LOG_INFO , " > Render size: %i x %i" , CORE .Window .render .width , CORE .Window .render .height );
0 commit comments