#include #include #include #include #include #include #define MAX_ELEMENTS 50 typedef struct { int x; int y; }position; typedef struct { position contenu[MAX_ELEMENTS]; int nombre; } liste_champi; void affichage(element_t e) { position *p = e; printf("%d %d \n", p->x, p->y); } int main() { srand(time(NULL)); char touche; unsigned char bas; void* detail; int largeur = 1000; int hauteur = 1000; liste_champi muschrooms={.nombre=0}; int h,w,l,i; char *titre = "Le Centipède"; creerSurface(largeur,hauteur,titre); int champi = chargerLutin("Lutins/millepatte_champi.bmp",0); if(champi<0){ printf("Champi pas là\n"); exit(-1); } int Teted = chargerLutin("Lutins/millepatte_tete_droite.bmp",0); tailleLutin(champi,&l,&h); position poschampi; int x = (rand()%20)*50+2; int y = (rand()%20)*50; afficherLutin(Teted,x,y); for(i = 0 ; i < 20; i++) { rectanglePlein(i*50,0,1,1000,5); rectanglePlein(0,i*50,1000,1,5); } for(w=0;w<10;w++) { poschampi.x = (rand()%20)*50; poschampi.y = (rand()%20)*50; muschrooms.contenu[muschrooms.nombre++]=poschampi; } printf("%d %d \n",l,h); for(w=0;w<10;w++){ afficherLutin(champi,(muschrooms.contenu[w].x)+1,(muschrooms.contenu[w].y)+6); } majSurface(); while(1){ while(!lireTouche(&bas,&touche,&detail)); printf("%d %c\n",bas,touche); if(touche=='a') { fermerSurface(); return 0; } } return 0; }