SAE11_2021/jeu.c

56 lines
1.0 KiB
C
Raw Normal View History

2022-11-30 17:23:59 +01:00
#include <stdio.h>
#include <stdlib.h>
#include <graph.h>
#include <time.h>
#include "images.h"
#include "temps.h"
#include "jeu.h"
#include <unistd.h>
int jeu(void){
2022-11-30 17:27:53 +01:00
int temps;
2022-11-30 17:23:59 +01:00
while(score<20){
2022-11-30 17:27:53 +01:00
temps=timer();
2022-11-30 17:23:59 +01:00
for (repet=0;repet<3;repet++){
if (SourisCliquee()){
clic_x=_X;
clic_y=_Y;
im_x=0;
im_y=0;
for (pos_y=370;pos_y>=10;pos_y=pos_y-90){
if (clic_y>=pos_y){
if (clic_y<=pos_y+80){
im_y=pos_y;
break;
}
}
}
for (pos_x=640;pos_x>=10;pos_x=pos_x-90){
if (clic_x>=pos_x){
if (clic_x<=pos_x+80){
im_x=pos_x;
break;
}
}
}
if (im_x!=0 && im_y!=0){
for (i=0;i<20;i++){
for (j=0;j<2;j++){
if (positions[i][(j*2)]==im_x){
if (positions[i][(j*2+1)]==im_y){
g=i+1;
snprintf(affichage,50,"Images/image%d.png",g);
comparer[repet]=affichage;
ChargerImage(affichage,im_x,im_y,0,0,80,80);
}
}
}
}
}
}
}
}
}