};
+
+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
};
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;
+}
+
+
+
+