diff options
author | Tristan Riehs <tristan.riehs@bordeaux-inp.fr> | 2024-06-22 17:39:30 +0900 |
---|---|---|
committer | Tristan Riehs <tristan.riehs@bordeaux-inp.fr> | 2024-06-22 17:39:30 +0900 |
commit | faccb2caed55454367403f1530db6ca9661af579 (patch) | |
tree | 44ad378bbca065a9f791280126a0def877dc24b9 /src | |
parent | 600f6d75f17b2fe7985b437122f695d3169cb916 (diff) |
Fix font size adjutment
Diffstat (limited to 'src')
-rw-r--r-- | src/ray.c | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -26,6 +26,8 @@ #define DEFAULT_HEIGHT 200 #define DEFAULT_WIDTH 16*DEFAULT_HEIGHT/9 +#define MAX_FONTSIZE 100 + static int current_input = 0; static int current_x; static int current_y; @@ -80,12 +82,17 @@ draw_calc(void) win_width = GetScreenWidth(); win_height = GetScreenHeight(); - font_size = min(win_height/3, 40); + font_size = min(win_height/3, MAX_FONTSIZE); txt_width = MeasureText(txt, font_size); + TraceLog(LOG_DEBUG, "win_width = %d", win_width); + TraceLog(LOG_DEBUG, "win_height = %d", win_height); + TraceLog(LOG_DEBUG, "txt_width = %d", txt_width); + TraceLog(LOG_DEBUG, "font_size = %d", font_size); + if (txt_width > win_width) { - float scale = txt_width/win_width; + float scale = ((float) txt_width)/win_width; font_size = font_size/scale; txt_width = MeasureText(txt, font_size); } @@ -120,7 +127,7 @@ draw_input(void) win_width = GetScreenWidth(); win_height = GetScreenHeight(); - font_size = min(win_height/4, 30); + font_size = min(win_height/4, 3*MAX_FONTSIZE/4); txt_width = MeasureText(txt, font_size); if (txt_width > win_width) |