aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ray.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/ray.c b/src/ray.c
index a655f8c..8fd5fbe 100644
--- a/src/ray.c
+++ b/src/ray.c
@@ -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)