void affichage_gtk(GtkWidget *aire_de_dessin,GdkPixmap *pixmap){
int x,y;
/*images pacman,ennemis...*/
GdkPixbuf *pImage_mur;
GdkPixbuf *pImage_pacman;
GdkPixbuf *pImage_ennemi;
GdkPixbuf *pImage_pastille;
/*création des images pacman ennemis murs etc*/
pImage_mur = gdk_pixbuf_new_from_file("images/mur.PNG",NULL);
pImage_pacman = gdk_pixbuf_new_from_file("images/pacman.PNG",NULL);
pImage_ennemi = gdk_pixbuf_new_from_file("images/ennemi.PNG",NULL);
pImage_pastille = gdk_pixbuf_new_from_file("images/pastille.PNG",NULL);
for (y=0;y<=28;y++){
for(x=0;x<=30;x++){
if (map.tab[x][y][0].mur.type=='m'){
gdk_draw_pixbuf(pixmap,aire_de_dessin->style->black_gc,pImage_mur,0,0,y*24,x*24,24,24,GDK_RGB_DITHER_MAX,0,0);
}
else if (map.tab[x][y][0].past.type=='p'){
gdk_draw_pixbuf(pixmap,aire_de_dessin->style->black_gc,pImage_pastille,0,0,y*24,x*24,24,24,GDK_RGB_DITHER_MAX,0,0);
}
else if (map.tab[x][y][0].joueur.type=='j'){
gdk_draw_pixbuf(pixmap,aire_de_dessin->style->black_gc,pImage_pacman,0,0,y*24,x*24,24,24,GDK_RGB_DITHER_MAX,0,0);
}
else if (map.tab[x][y][1].mechant.type=='e'){
gdk_draw_pixbuf(pixmap,aire_de_dessin->style->black_gc,pImage_ennemi,0,0,y*24,x*24,24,24,GDK_RGB_DITHER_MAX,0,0);
}
}
}
gtk_widget_queue_draw( aire_de_dessin ) ;
}
Partager