mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-10 16:03:15 -04:00
Quick fix for UI elements being scaled too large on desktop with high DPI (thanks FizzWhiz)
This commit is contained in:
parent
1728314b59
commit
add56ce622
12
src/Gui.c
12
src/Gui.c
@ -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) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user