From dc2a0b1473fd097a31bb98aa5c2caf5c8c355b7a Mon Sep 17 00:00:00 2001 From: mibi88 Date: Tue, 11 Jul 2023 13:29:48 +0200 Subject: [PATCH] Continued improving it. --- src/dialogs.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/src/dialogs.c b/src/dialogs.c index abc7ba3..ced3569 100644 --- a/src/dialogs.c +++ b/src/dialogs.c @@ -12,8 +12,8 @@ void showtext(Game *game, bopti_image_t *face, char *text) { dfont(&FONT_USED); unsigned int i, n, y = 1, l = 0; int line_max_chars; - unsigned int max_lines_amount = BOX_HEIGHT/(FONT_USED.line_height + - FONT_USED.char_spacing); + unsigned int max_lines_amount = BOX_HEIGHT/FONT_USED.line_height; + const char *c; /* Run a little fancy animation. */ for(i=0;i0; n--) { /* If we found a space, we can draw this line and do the same for * the next line. */ if(text[i+n] == ' '){ - dtext_opt(1, y, C_BLACK, C_NONE, DTEXT_TOP, DTEXT_LEFT, text+i, - n); /* Draw everything. */ - /* Increment y by the line height plus the space between them. - */ - y += FONT_USED.line_height+FONT_USED.char_spacing; + dtext_opt(BOX_HEIGHT, y, C_BLACK, C_NONE, DTEXT_TOP, DTEXT_LEFT, + text+i, n); /* Draw everything. */ + /* Increment y by the line height. */ + y += FONT_USED.line_height; i += n; /* We drew everything to i+n */ l++; /* We drew one more line. */ break; @@ -57,17 +58,17 @@ void showtext(Game *game, bopti_image_t *face, char *text) { while(game->frame_duration < 20) sleep(); game->frame_duration = 0; /* Ask the user to press EXE to continue. */ - dtext(1, y, C_BLACK, "[EXE] To continue ..."); - /* Reset y and l. */ - y = 1; - l = 0; + dtext(BOX_HEIGHT, y, C_BLACK, "[EXE] to continue ..."); /* Clear the screen. */ - drect(0, i*PXSIZE, DWIDTH, (i+1)*PXSIZE, C_BLACK); + drect(0, 0, DWIDTH, BOX_HEIGHT*PXSIZE, C_WHITE); } /* Make a little animation :). */ dupdate(); if(l>=max_lines_amount-1){ while(getkey().key != KEY_EXE) sleep(); + /* Reset y and l. */ + y = 1; + l = 0; } else{ while(game->frame_duration < 20) sleep();