diff options
author | Tristan Riehs <tristan.riehs@bordeaux-inp.fr> | 2024-06-28 14:20:03 +0900 |
---|---|---|
committer | Tristan Riehs <tristan.riehs@bordeaux-inp.fr> | 2024-06-28 14:20:03 +0900 |
commit | bdcaf8ea6adb90470bbd75ee143da65e4a2b618e (patch) | |
tree | 7146ef5eb4967783b0dde3c7faf29f162e7555db | |
parent | 1ebb0f1a135af6febab5aefbf9247a08c90f33d1 (diff) |
Ensure window regions do not overlap
-rw-r--r-- | src/ray.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -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); |