61 lines
1.1 KiB
C
61 lines
1.1 KiB
C
|
#include<stdlib.h>
|
||
|
#include<stdio.h>
|
||
|
#include<graph.h>
|
||
|
#include<time.h>
|
||
|
|
||
|
#define H 40
|
||
|
#define L 60
|
||
|
#define CYCLE 100000L;
|
||
|
|
||
|
void graphique(int n){
|
||
|
InitialiserGraphique();
|
||
|
CreerFenetre(1700,950,1700,950);
|
||
|
couleur c, b;
|
||
|
b=CouleurParComposante(0,0,0);
|
||
|
ChoisirCouleurDessin(b);
|
||
|
RemplirRectangle(0,0,1750,950);
|
||
|
c=CouleurParComposante(111,255,94);
|
||
|
ChoisirCouleurDessin(c);
|
||
|
RemplirRectangle(100,100,1500,750);
|
||
|
Touche();
|
||
|
FermerGraphique();
|
||
|
};
|
||
|
enum Direction {Stop=0,Droite=XK_Right,Gauche=XK_Left,Haut=XK_Up,Bas=XK_Down};
|
||
|
enum Direction direction;
|
||
|
|
||
|
void snake(){
|
||
|
couleur s;
|
||
|
s=CouleurParNom("yellow");
|
||
|
ChoisirCouleurDessin(s);
|
||
|
RemplirRectangle(200,200);
|
||
|
|
||
|
}
|
||
|
int main(void){
|
||
|
int n;
|
||
|
graphique();
|
||
|
int tab[H][L];
|
||
|
int i,j,posx=100,posy=100,n=0;
|
||
|
double suivant;
|
||
|
suivant=Microseconde()+CYCLE;
|
||
|
for(i=0;i<H;i++){
|
||
|
for(j=0;j<L;j++){
|
||
|
tab[i][j]=0;
|
||
|
}
|
||
|
}
|
||
|
while(1){
|
||
|
if (Microsecondes()>suivant){
|
||
|
n++;
|
||
|
graphique();
|
||
|
suivant= Microseconde()+CYCLE;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
return EXIT_SUCCESS;
|
||
|
}
|
||
|
|
||
|
|
||
|
|