Quick fix for UI elements being scaled too large on desktop with high DPI (thanks FizzWhiz)

This commit is contained in:
UnknownShadow200 2022-01-07 23:14:22 +11:00
parent 1728314b59
commit add56ce622

View File

@ -26,8 +26,16 @@ static cc_uint8 priorities[GUI_MAX_SCREENS];
*----------------------------------------------------------Gui------------------------------------------------------------* *----------------------------------------------------------Gui------------------------------------------------------------*
*#########################################################################################################################*/ *#########################################################################################################################*/
static CC_NOINLINE int GetWindowScale(void) { static CC_NOINLINE int GetWindowScale(void) {
float windowScale = min(WindowInfo.Width / 640.0f, WindowInfo.Height / 480.0f); float widthScale = WindowInfo.Width / 640.0f;
return 1 + (int)windowScale; float heightScale = WindowInfo.Height / 480.0f;
/* Use larger UI scaling on mobile */
/* TODO move this DPI scaling elsewhere.,. */
if (!Input_TouchMode) {
widthScale /= DisplayInfo.ScaleX;
heightScale /= DisplayInfo.ScaleY;
}
return 1 + (int)(min(widthScale, heightScale));
} }
float Gui_Scale(float value) { float Gui_Scale(float value) {