Collab_RPG/src/dialogs.c

47 lines
1.4 KiB
C
Raw Normal View History

#include "dialogs.h"
#include <gint/keyboard.h>
#include <gint/cpu.h>
#define BOX_HEIGHT (F_HEIGHT/PXSIZE+8)
extern font_t fontRPG;
void showtext(Game *game, bopti_image_t *face, char *text) {
dfont(&fontRPG);
unsigned int i;
for(i=0;i<BOX_HEIGHT;i++){
draw(game);
drect(0, 0, DWIDTH, i*PXSIZE, C_WHITE);
drect(0, i*PXSIZE, DWIDTH, (i+1)*PXSIZE, C_BLACK);
dsubimage(4*PXSIZE, 2*PXSIZE, face, 0, 0, F_WIDTH, (i-8)*PXSIZE,
DIMAGE_NONE);
dupdate();
while(game->frame_duration < 20) sleep();
game->frame_duration = 0;
}
/* We should start to drawint the text on the x axis at BOX_HEIGHT to avoid
* drawing on the face. */
/* Show a little message that showing text in dialogs is not implemented
* yet. */
dtext(BOX_HEIGHT*PXSIZE, 1, C_BLACK, "Dialogs not implemented");
dtext(BOX_HEIGHT*PXSIZE, 8*PXSIZE, C_BLACK, "Press any key");
dupdate();
getkey();
for(i=0;i<strlen(text);i++){
/**/
}
for(i=40;i>0;i--){
draw(game);
drect(0, 0, DWIDTH, i*PXSIZE, C_WHITE);
drect(0, i*PXSIZE, DWIDTH, (i+1)*PXSIZE, C_BLACK);
dsubimage(4*PXSIZE, 2*PXSIZE, face, 0, 0, F_WIDTH, (i-8)*PXSIZE,
DIMAGE_NONE);
dupdate();
while(game->frame_duration < 20) sleep();
game->frame_duration = 0;
}
}