From 737e4ce33fbcc422f4bdef42f7081134d09b5e08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Madar=C3=A1sz?= Date: Sat, 10 Feb 2024 21:55:16 +0100 Subject: [PATCH] font: preserve font cursor --- engine/joint/v4k.h | 4 ++-- engine/split/v4k_font.c | 4 ++-- engine/v4k.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/engine/joint/v4k.h b/engine/joint/v4k.h index 324b8ed..62c7c57 100644 --- a/engine/joint/v4k.h +++ b/engine/joint/v4k.h @@ -363805,7 +363805,7 @@ vec2 font_clip(const char *text, vec4 rect) { } vec2 dims = font_draw_ex(text, gotoxy, rect, NULL, font_draw_cmd); gotoxy.y += strchr(text, '\n') ? dims.y : 0; - gotoxy.x = strchr(text, '\n') ? rect.x : gotoxy.x + dims.x; + gotoxy.x = strchr(text, '\n') ? gotoxy.x + rect.x : gotoxy.x + dims.x; return dims; } } @@ -363889,7 +363889,7 @@ vec2 font_highlight(const char *text, const void *colors) { vec4 screen_dim = {0, 0, window_width(), window_height()}; vec2 dims = font_draw_ex(text, gotoxy, screen_dim, (const char *)colors, font_draw_cmd); gotoxy.y += strchr(text, '\n') ? dims.y : 0; - gotoxy.x = strchr(text, '\n') ? 0 : gotoxy.x + dims.x; + gotoxy.x += !strchr(text, '\n') ? gotoxy.x + dims.x : 0; return dims; } diff --git a/engine/split/v4k_font.c b/engine/split/v4k_font.c index 6b28324..39a72f5 100644 --- a/engine/split/v4k_font.c +++ b/engine/split/v4k_font.c @@ -2248,7 +2248,7 @@ vec2 font_clip(const char *text, vec4 rect) { } vec2 dims = font_draw_ex(text, gotoxy, rect, NULL, font_draw_cmd); gotoxy.y += strchr(text, '\n') ? dims.y : 0; - gotoxy.x = strchr(text, '\n') ? rect.x : gotoxy.x + dims.x; + gotoxy.x = strchr(text, '\n') ? gotoxy.x + rect.x : gotoxy.x + dims.x; return dims; } } @@ -2332,7 +2332,7 @@ vec2 font_highlight(const char *text, const void *colors) { vec4 screen_dim = {0, 0, window_width(), window_height()}; vec2 dims = font_draw_ex(text, gotoxy, screen_dim, (const char *)colors, font_draw_cmd); gotoxy.y += strchr(text, '\n') ? dims.y : 0; - gotoxy.x = strchr(text, '\n') ? 0 : gotoxy.x + dims.x; + gotoxy.x += !strchr(text, '\n') ? gotoxy.x + dims.x : 0; return dims; } diff --git a/engine/v4k.c b/engine/v4k.c index 44d5129..cfd08f3 100644 --- a/engine/v4k.c +++ b/engine/v4k.c @@ -10946,7 +10946,7 @@ vec2 font_clip(const char *text, vec4 rect) { } vec2 dims = font_draw_ex(text, gotoxy, rect, NULL, font_draw_cmd); gotoxy.y += strchr(text, '\n') ? dims.y : 0; - gotoxy.x = strchr(text, '\n') ? rect.x : gotoxy.x + dims.x; + gotoxy.x = strchr(text, '\n') ? gotoxy.x + rect.x : gotoxy.x + dims.x; return dims; } } @@ -11030,7 +11030,7 @@ vec2 font_highlight(const char *text, const void *colors) { vec4 screen_dim = {0, 0, window_width(), window_height()}; vec2 dims = font_draw_ex(text, gotoxy, screen_dim, (const char *)colors, font_draw_cmd); gotoxy.y += strchr(text, '\n') ? dims.y : 0; - gotoxy.x = strchr(text, '\n') ? 0 : gotoxy.x + dims.x; + gotoxy.x += !strchr(text, '\n') ? gotoxy.x + dims.x : 0; return dims; }