font: improve cursor advancing

main
Dominik Madarász 2024-02-10 22:14:00 +01:00
parent 737e4ce33f
commit c25f4ba912
3 changed files with 6 additions and 6 deletions

View File

@ -363805,7 +363805,7 @@ vec2 font_clip(const char *text, vec4 rect) {
} }
vec2 dims = font_draw_ex(text, gotoxy, rect, NULL, font_draw_cmd); vec2 dims = font_draw_ex(text, gotoxy, rect, NULL, font_draw_cmd);
gotoxy.y += strchr(text, '\n') ? dims.y : 0; gotoxy.y += strchr(text, '\n') ? dims.y : 0;
gotoxy.x = strchr(text, '\n') ? gotoxy.x + rect.x : gotoxy.x + dims.x; gotoxy.x += !strchr(text, '\n') ? dims.x : 0;
return dims; return dims;
} }
} }
@ -363889,7 +363889,7 @@ vec2 font_highlight(const char *text, const void *colors) {
vec4 screen_dim = {0, 0, window_width(), window_height()}; vec4 screen_dim = {0, 0, window_width(), window_height()};
vec2 dims = font_draw_ex(text, gotoxy, screen_dim, (const char *)colors, font_draw_cmd); vec2 dims = font_draw_ex(text, gotoxy, screen_dim, (const char *)colors, font_draw_cmd);
gotoxy.y += strchr(text, '\n') ? dims.y : 0; gotoxy.y += strchr(text, '\n') ? dims.y : 0;
gotoxy.x += !strchr(text, '\n') ? gotoxy.x + dims.x : 0; gotoxy.x += !strchr(text, '\n') ? dims.x : 0;
return dims; return dims;
} }

View File

@ -2248,7 +2248,7 @@ vec2 font_clip(const char *text, vec4 rect) {
} }
vec2 dims = font_draw_ex(text, gotoxy, rect, NULL, font_draw_cmd); vec2 dims = font_draw_ex(text, gotoxy, rect, NULL, font_draw_cmd);
gotoxy.y += strchr(text, '\n') ? dims.y : 0; gotoxy.y += strchr(text, '\n') ? dims.y : 0;
gotoxy.x = strchr(text, '\n') ? gotoxy.x + rect.x : gotoxy.x + dims.x; gotoxy.x += !strchr(text, '\n') ? dims.x : 0;
return dims; return dims;
} }
} }
@ -2332,7 +2332,7 @@ vec2 font_highlight(const char *text, const void *colors) {
vec4 screen_dim = {0, 0, window_width(), window_height()}; vec4 screen_dim = {0, 0, window_width(), window_height()};
vec2 dims = font_draw_ex(text, gotoxy, screen_dim, (const char *)colors, font_draw_cmd); vec2 dims = font_draw_ex(text, gotoxy, screen_dim, (const char *)colors, font_draw_cmd);
gotoxy.y += strchr(text, '\n') ? dims.y : 0; gotoxy.y += strchr(text, '\n') ? dims.y : 0;
gotoxy.x += !strchr(text, '\n') ? gotoxy.x + dims.x : 0; gotoxy.x += !strchr(text, '\n') ? dims.x : 0;
return dims; return dims;
} }

View File

@ -10946,7 +10946,7 @@ vec2 font_clip(const char *text, vec4 rect) {
} }
vec2 dims = font_draw_ex(text, gotoxy, rect, NULL, font_draw_cmd); vec2 dims = font_draw_ex(text, gotoxy, rect, NULL, font_draw_cmd);
gotoxy.y += strchr(text, '\n') ? dims.y : 0; gotoxy.y += strchr(text, '\n') ? dims.y : 0;
gotoxy.x = strchr(text, '\n') ? gotoxy.x + rect.x : gotoxy.x + dims.x; gotoxy.x += !strchr(text, '\n') ? dims.x : 0;
return dims; return dims;
} }
} }
@ -11030,7 +11030,7 @@ vec2 font_highlight(const char *text, const void *colors) {
vec4 screen_dim = {0, 0, window_width(), window_height()}; vec4 screen_dim = {0, 0, window_width(), window_height()};
vec2 dims = font_draw_ex(text, gotoxy, screen_dim, (const char *)colors, font_draw_cmd); vec2 dims = font_draw_ex(text, gotoxy, screen_dim, (const char *)colors, font_draw_cmd);
gotoxy.y += strchr(text, '\n') ? dims.y : 0; gotoxy.y += strchr(text, '\n') ? dims.y : 0;
gotoxy.x += !strchr(text, '\n') ? gotoxy.x + dims.x : 0; gotoxy.x += !strchr(text, '\n') ? dims.x : 0;
return dims; return dims;
} }