From e89f3c362f1f15c634deb0301f35903030cbfe5a Mon Sep 17 00:00:00 2001 From: parking_turkeys Date: Fri, 17 Jul 2026 14:04:44 -0400 Subject: [PATCH] fuck this. this is stupid im going to look up the official example for text wrapping ig actually one more try for this on my own --- level.c | 58 +++++++++++++++++++++++++++++++++------------------------ 1 file changed, 34 insertions(+), 24 deletions(-) diff --git a/level.c b/level.c index 15f2639..0600682 100644 --- a/level.c +++ b/level.c @@ -124,34 +124,22 @@ int drawcharimage(char *filename) }; + +static char *get_next_word(char *s, int *i); + int drawdialogueline(char *l) { //DLGTEXTWIDTH (i always forget how to type this) - - //gay + //ok im going to try doing this letter by letter :) + int x = CHARADISPLAYWIDTH + DLGPADDING; + int y = DLGY + DLGPADDING * 2; + char *w; int i = 0; - char t = l[40]; - int x = 40; - int z = 0; - int y = CHARADISPLAYWIDTH + DLGPADDING; - int done = 0; - - while (done != 1) { - if (MeasureText(l+z, 20) <= DLGTEXTWIDTH) { - DrawText(l, y, DLGY + DLGPADDING * 2 ,20, BLACK); - y += 22; - z = x; - l[x] = t; - x += 30; - - } else { - x -= 10; - t = l[x]; - l[x] = '\0'; - }; - - - } + + while ((w = get_next_word(l+i, &i)) != "\0") { + printf("%d", i); + }; + //DrawText(l, CHARADISPLAYWIDTH + DLGPADDING, DLGY + DLGPADDING * 2 ,20, BLACK); //add text wrapping later }; @@ -160,3 +148,25 @@ int cleanup_level(void) UnloadTexture(txtr); return 1; } + + +char *get_next_word(char *s, int *i) +{ + char c; + char *w = ""; + int n = 0; + + while ((c = s[*i]) != ' ') { + //printf(&c); + w[n] = c; //printf("char added to word"); + n++; + *i += 1; + if (c == '\0') {return w;}; + }; + w[n] = '\0'; + return w; +} + + + + -- 2.47.3