change the djui auto scale math
Some checks are pending
Build coop / build-linux (push) Waiting to run
Build coop / build-steamos (push) Waiting to run
Build coop / build-windows-opengl (push) Waiting to run
Build coop / build-windows-directx (push) Waiting to run
Build coop / build-macos-arm (push) Waiting to run
Build coop / build-macos-intel (push) Waiting to run

unfortunately the completely dynamic method causes scaling issues with text
This commit is contained in:
Isaac0-dev 2025-06-14 14:35:09 +10:00
parent c13352d6a2
commit aea1ab9b86

View file

@ -8,6 +8,7 @@
#include "gfx_dimensions.h"
#include "djui_gfx.h"
#include "pc/debuglog.h"
#include "engine/math_util.h"
const Gfx dl_djui_display_list_begin[] = {
gsSPTextureAddrDjui(1),
@ -61,11 +62,15 @@ const Gfx dl_djui_simple_rect[] = {
gsSPEndDisplayList(),
};
f32 round_to_multiple_f(f32 value, f32 multiple) {
return roundf(value / multiple) * multiple;
}
f32 djui_gfx_get_scale(void) {
if (configDjuiScale == 0) { // auto
u32 windowWidth, windowHeight;
gfx_get_dimensions(&windowWidth, &windowHeight);
return ((f32)windowHeight / (f32)SCREEN_HEIGHT) / 4.0f;
return clamp(round_to_multiple_f(((f32)windowHeight / (f32)SCREEN_HEIGHT) / 4.0f, 0.5f), 0.5f, 1.5f);
} else {
switch (configDjuiScale) {
case 1: return 0.5f;