J'ai ajouté un ércan de fin quand le taquin est complété , mais il y a d'autres chose a réglé comme le fait que le nombre de ligne et cologne était des constante ,la case vide doit être en haut a gauche et pas en bas a droite , et rajouter des déplacements avec la souris et pas juste les fléches
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
int main(void){
|
||||
int grille[NB_LIGNES][NB_COLS], touche;
|
||||
char *nom_image = NULL;
|
||||
int choix_fait = 0;
|
||||
int choix_fait = 0,jeu_fini = 0;
|
||||
|
||||
init_affichage();
|
||||
|
||||
@@ -26,21 +26,20 @@ int main(void){
|
||||
if(ToucheEnAttente()) {
|
||||
touche = Touche();
|
||||
|
||||
printf("Touche reçue : %d (Caractère : %c)\n", touche, (char)touche);
|
||||
|
||||
if(touche == '1' || touche == 38) {
|
||||
if(touche == XK_1 || touche == XK_KP_1) {
|
||||
nom_image = "image1.png";
|
||||
choix_fait = 1;
|
||||
}
|
||||
else if(touche == '2' || touche == 233) {
|
||||
else if(touche == XK_2 || touche == XK_KP_2) {
|
||||
nom_image = "image2.png";
|
||||
choix_fait = 2;
|
||||
}
|
||||
else if(touche == '3' || touche == 34) {
|
||||
else if(touche == XK_3 || touche == XK_KP_3) {
|
||||
nom_image = "image3.png";
|
||||
choix_fait = 3;
|
||||
}
|
||||
else if(touche == 'q' || touche == 27) {
|
||||
else if(touche == XK_q || touche == XK_Q) {
|
||||
fermer_affichage();
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
@@ -55,23 +54,38 @@ int main(void){
|
||||
|
||||
afficher_plateau(grille);
|
||||
|
||||
while(1){
|
||||
while(jeu_fini == 0){
|
||||
|
||||
if (ToucheEnAttente()){
|
||||
touche = Touche();
|
||||
|
||||
/* Pour quitter cliquer sur q minuscule ou Escape (27) */
|
||||
if (touche == 'q' || touche == 27) break;
|
||||
/* Pour quitter on clique sur q */
|
||||
if (touche == XK_q || touche == XK_Q) break;
|
||||
|
||||
/* Debug : affiche le code touche */
|
||||
printf("Touche appuyée : %d\n", touche);
|
||||
|
||||
/* Déplacement et mise a jour de l'affichage */
|
||||
/* Déplacement +on affiche la nouvelle grille */
|
||||
deplacer(grille, touche);
|
||||
afficher_plateau(grille);
|
||||
/*On vérifie si on a gagner */
|
||||
if(verifier_victoire(grille) == 1 ){
|
||||
jeu_fini = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (jeu_fini == 1){
|
||||
ChoisirCouleurDessin(CouleurParNom("white"));
|
||||
RemplirRectangle(50,150,300,100);
|
||||
|
||||
ChoisirCouleurDessin(CouleurParNom("red"));
|
||||
EcrireTexte(60,200,"Bravo",2);
|
||||
EcrireTexte(60,230,"Appuyer pour quitter...",1);
|
||||
|
||||
Touche();
|
||||
}
|
||||
|
||||
|
||||
|
||||
fermer_affichage();
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
Reference in New Issue
Block a user