79 lines
1.7 KiB
C
79 lines
1.7 KiB
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include "affichage.h"
|
|
#include <graph.h>
|
|
#include "config.h"
|
|
#include "partie.h"
|
|
|
|
int main(void){
|
|
int grille[NB_LIGNES][NB_COLS], touche;
|
|
char *nom_image = NULL;
|
|
int choix_fait = 0;
|
|
|
|
init_affichage();
|
|
|
|
EffacerEcran(CouleurParNom("white"));
|
|
ChoisirCouleurDessin(CouleurParNom("black"));
|
|
|
|
EcrireTexte(50, 50, "MENU TAQUIN", 2);
|
|
EcrireTexte(50, 100, "Choisissez votre image :", 1);
|
|
EcrireTexte(50, 150, "Touche 1 : Image 1", 1);
|
|
EcrireTexte(50, 180, "Touche 2 : Image 2", 1);
|
|
EcrireTexte(50, 210, "Touche 3 : Image 3", 1);
|
|
EcrireTexte(50, 300, "(Appuyez sur q pour quitter)", 1);
|
|
|
|
while(choix_fait == 0) {
|
|
if(ToucheEnAttente()) {
|
|
touche = Touche();
|
|
|
|
printf("Touche reçue : %d (Caractère : %c)\n", touche, (char)touche);
|
|
|
|
if(touche == '1' || touche == 38) {
|
|
nom_image = "image1.png";
|
|
choix_fait = 1;
|
|
}
|
|
else if(touche == '2' || touche == 233) {
|
|
nom_image = "image2.png";
|
|
choix_fait = 2;
|
|
}
|
|
else if(touche == '3' || touche == 34) {
|
|
nom_image = "image3.png";
|
|
choix_fait = 3;
|
|
}
|
|
else if(touche == 'q' || touche == 27) {
|
|
fermer_affichage();
|
|
return EXIT_SUCCESS;
|
|
}
|
|
}
|
|
}
|
|
|
|
charger_image_source(nom_image);
|
|
|
|
initialiser_plateau(grille);
|
|
|
|
melanger_plateau(grille);
|
|
|
|
afficher_plateau(grille);
|
|
|
|
while(1){
|
|
|
|
if (ToucheEnAttente()){
|
|
touche = Touche();
|
|
|
|
/* 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);
|
|
}
|
|
|
|
}
|
|
|
|
fermer_affichage();
|
|
return EXIT_SUCCESS;
|
|
}
|