From bdcaf8ea6adb90470bbd75ee143da65e4a2b618e Mon Sep 17 00:00:00 2001 From: Tristan Riehs Date: Fri, 28 Jun 2024 14:20:03 +0900 Subject: Ensure window regions do not overlap --- src/ray.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/ray.c b/src/ray.c index 998fe8b..19e96f5 100644 --- a/src/ray.c +++ b/src/ray.c @@ -158,6 +158,15 @@ draw_res(void) win_width = GetScreenWidth(); win_height = GetScreenHeight(); + font_size = min(win_height/STATE_COUNT, MAX_FONTSIZE/2); + + txt_width = MeasureText("60 + 60 = 120 10000ms", font_size); + + if (txt_width > win_width/2) + { + float scale = ((float) txt_width)/(win_width/2); + font_size = font_size/scale; + } for (int i = 1; i < STATE_COUNT; i++) { @@ -181,7 +190,6 @@ draw_res(void) states[j].x, states[j].y, states[j].input, states[j].ms); - font_size = min(win_height/STATE_COUNT, MAX_FONTSIZE/2); txt_width = MeasureText(txt, font_size); DrawText(txt, win_width-txt_width, (int) font_size*1.2*(i-1), font_size, col); -- cgit v1.2.3