Fixed a displaying bug (thanks Slyvtt !)

This commit is contained in:
mibi88 2023-07-11 23:32:09 +02:00
parent 6fa6f03c1a
commit 4956d0de31

View file

@ -12,7 +12,7 @@ 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;
unsigned int max_lines_amount = (BOX_HEIGHT-1)/FONT_USED.line_height;
const char *c;
/* Run a little fancy animation. */
for(i=0;i<BOX_HEIGHT;i++){
@ -41,7 +41,7 @@ void showtext(Game *game, bopti_image_t *face, char *text) {
/* If we found a space, we can draw this line and do the same for
* the next line. */
if(text[i+n] == ' '){
dtext_opt(BOX_HEIGHT, y, C_BLACK, C_NONE, DTEXT_TOP, DTEXT_LEFT,
dtext_opt(BOX_HEIGHT, y, C_BLACK, C_NONE, DTEXT_LEFT, DTEXT_TOP,
text+i, n); /* Draw everything. */
/* Increment y by the line height. */
y += FONT_USED.line_height;