2025-11-30 16:16:27 +01:00
|
|
|
#include <stdio.h>
|
2025-11-30 19:40:22 +01:00
|
|
|
#include <stdlib.h>
|
2025-11-29 20:25:05 +01:00
|
|
|
#include "affichage.h"
|
|
|
|
|
#include <graph.h>
|
2025-11-30 16:16:27 +01:00
|
|
|
#include "config.h"
|
|
|
|
|
#include "partie.h"
|
2025-11-30 19:40:22 +01:00
|
|
|
|
2025-11-29 20:25:05 +01:00
|
|
|
int main(void){
|
2025-11-30 19:40:22 +01:00
|
|
|
int grille[NB_LIGNES][NB_COLS], touche;
|
|
|
|
|
|
2025-11-29 20:25:05 +01:00
|
|
|
init_affichage();
|
2025-11-30 19:40:22 +01:00
|
|
|
|
2025-11-30 16:16:27 +01:00
|
|
|
initialiser_plateau(grille);
|
2025-11-30 19:40:22 +01:00
|
|
|
|
|
|
|
|
melanger_plateau(grille);
|
|
|
|
|
|
2025-11-30 16:16:27 +01:00
|
|
|
afficher_plateau(grille);
|
2025-11-29 20:25:05 +01:00
|
|
|
|
|
|
|
|
while(1){
|
|
|
|
|
|
|
|
|
|
if (ToucheEnAttente()){
|
2025-11-30 16:16:27 +01:00
|
|
|
touche = Touche();
|
2025-11-29 20:25:05 +01:00
|
|
|
|
2025-11-30 19:40:22 +01:00
|
|
|
/* Pour quitter cliquer sur q minuscule ou Escape (27) */
|
|
|
|
|
if (touche == 'q' || touche == 27) break;
|
|
|
|
|
|
|
|
|
|
/* Debug : affiche le code touche */
|
|
|
|
|
printf("Touche appuyée : %d\n", touche);
|
|
|
|
|
|
|
|
|
|
/* Déplacement et mise a jour de l'affichage */
|
|
|
|
|
deplacer(grille, touche);
|
|
|
|
|
afficher_plateau(grille);
|
2025-11-29 20:25:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
2025-11-30 19:40:22 +01:00
|
|
|
|
2025-11-29 20:25:05 +01:00
|
|
|
fermer_affichage();
|
2025-11-30 19:40:22 +01:00
|
|
|
return EXIT_SUCCESS;
|
2025-11-29 20:25:05 +01:00
|
|
|
}
|