diff options
-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) |