// ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» \\
// º º º \\
// º AFFICHE_SCORE º Score, R‚actualisation º \\
// º º º \\
// ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÊÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹ \\
// º º \\
// º þ On affiche le nombre de points … l'‚cran, avec 8 chiffres. º \\
// º º \\
// ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ \\
void affiche_score (long int score, int refresh)
{
char *msg; // msg servira … afficher le score, ici c'est un pointeur
msg = (char *) malloc(10); // msg contiendra 10 caractŠres maximum
setcolor (LIGHTRED); // couleur rouge clair
settextjustify (RIGHT_TEXT, CENTER_TEXT); // centr‚ horizontalement et verticalement
sprintf (msg, "%08d", score); // le score est toujours avec 8 chiffres
outtextxy (630, 120, msg); // on affiche le score … l'‚cran
if (refresh == 0) // si on demande de raffraichir le score
{
setcolor (BLACK); // couleur noire
outtextxy (630, 120, msg); // on efface le texte
}
free(msg); // on libŠre le pointeur et la m‚moire
}
// ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» \\
// º º º \\
// º AFFICHE_VIE º Vie, R‚actualisation º \\
// º º º \\
// ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÊÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹ \\
// º º \\
// º þ On affiche le nombre de vies … l'‚cran. º \\
// º º \\
// ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ \\
void affiche_vie (int vie, int refresh)
{
char *msg;
msg = (char *) malloc(3); // msg contiendra 3 caractŠres maximum
setcolor (LIGHTRED);
settextjustify (RIGHT_TEXT, CENTER_TEXT); // centr‚ horizontalement et verticalement
sprintf (msg, "%d", vie); // conversion entier -> chaŚne
outtextxy (630, 180, msg); // on affiche la vie
if (refresh == 0) // si on veut raffraichir
{
setcolor (BLACK); // couleur noir
outtextxy (630, 180, msg); // on ‚crit
}
free(msg); // on libŠre le pointeur et la m‚moire
}
// ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» \\
// º º º \\
// º AFFICHE_BONUS º Bonus, R‚actualisation º \\
// º º º \\
// ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÊÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹ \\
// º º \\
// º þ On affiche le nom du bonus … l'‚cran. º \\
// º º \\
// ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ \\
void affiche_bonus(int bonus, int refresh)
{
char *msg;
msg = (char *) malloc(10); // msg contiendra 10 caractŠres maximum
setcolor (LIGHTRED);
settextjustify (RIGHT_TEXT, CENTER_TEXT); // centr‚ horizontalement et verticalement
switch (bonus)
{
case 0 : sprintf (msg, "Aucun"); break;
}
outtextxy (630, 240, msg); // on affiche le nom du bonus
if (refresh == 0) // si on veut raffraŚchir
{
setcolor (BLACK);
outtextxy (630, 240, msg); // on affiche le bonus en noir
}
free(msg); // on libŠre le pointeur et la m‚moire
}
// ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» \\
// º º º \\
// º AFFICHE_TEMPS º Temps actuel, pr‚c‚dent, de d‚part º \\
// º º º \\
// ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÊÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹ \\
// º º \\
// º þ On affiche le temps, au diziŠme de seconde prŠs. º \\
// º º \\
// ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ \\
void affiche_temps(struct time *t, struct time *told, struct time *deb/*, struct_jeu *jeu*/)
{
int x=0; // d‚calage du texte
static int min;
char *msg; // texte
msg = (char *) malloc(6); // msg contiendra 6 caractŠres maximum
settextjustify (RIGHT_TEXT, CENTER_TEXT); // centr‚ horizontalement et align‚ … droite
// pour les secondes, on affiche ou pas
if (t->ti_sec-deb->ti_sec == told->ti_sec-deb->ti_sec)
setcolor (12);
else
setcolor (0);
jeu.sec = abs(60+(told->ti_sec-deb->ti_sec))%60;
sprintf (msg, "%02ds ", jeu.sec);
outtextxy (630+x, 300, msg);
x -= textwidth(msg); // on d‚cale vers la gauche
if (jeu.sec == 0) min = 1; // on active l'affichage de la nouvelle minute
// pour les minutes
if (min == 1)
{
setcolor (BLACK); // on efface
sprintf (msg, "%02dm ", abs(59+(told->ti_min-deb->ti_min))%60);
outtextxy (630+x, 300, msg);
jeu.min = abs(60+(told->ti_min-deb->ti_min))%60;
setcolor (LIGHTRED); // on affiche
sprintf (msg, "%02dm ", jeu.min);
outtextxy (630+x, 300, msg);
min = 0;
}
*told = *t; // l'heure est mise … jour
}
// ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» \\
// º º º \\
// º AFFICHE_NIVO º Nom du niveau º \\
// º º º \\
// ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÊÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹ \\
// º º \\
// º þ On affiche le nom actuel du niveau. º \\
// º º \\
// ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ \\
void affiche_nivo(char *msg, int refresh)
{
setcolor (LIGHTRED);
settextjustify (RIGHT_TEXT, CENTER_TEXT);
settextstyle (SMALL_FONT, HORIZ_DIR, 6); // nø de police, ‚crire horizontalement, taille 4
outtextxy (630, 360, msg);
if (refresh == 1)
{
setcolor (BLACK);
outtextxy (630, 360, msg);
}
}
// ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» \\
// º º º \\
// º AFFICHE_HIGHSCORE º Position d'affichage du High Score º \\
// º º º \\
// ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÊÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹ \\
// º º \\
// º þ On affiche un High Score. º \\
// º º \\
// ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ \\
void affiche_HighScore(int pos)
{
char *msg;
setfillstyle (SOLID_FILL, 4); // style solide, couleur rouge
bar3d (pos, 255, pos+110, 420, 0, 1);
settextstyle(2, HORIZ_DIR, 6); // nø de police, ‚crire horizontalement, taille 4
settextjustify(CENTER_TEXT, CENTER_TEXT); // centr‚ horizontalement et verticalement
setcolor(YELLOW);
outtextxy(pos+55, 275, "HIGH SCORE");
settextstyle(2, HORIZ_DIR, 5); // nø de police, ‚crire horizontalement, taille 4
setcolor(WHITE);
for (int i=0; i<5; i++)
{
sprintf(msg, "%s -> %d", jeu.hscore[i].nom, jeu.hscore[i].points);
outtextxy(pos+55, 300+25*i, msg);
}
}