50 lines
1.0 KiB
C
50 lines
1.0 KiB
C
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include <graph.h>
|
|
|
|
#define delta 1000000L
|
|
|
|
int main(void)
|
|
{
|
|
unsigned long suivant;
|
|
int go_on=1;
|
|
int n;
|
|
|
|
InitialiserGraphique();
|
|
CreerFenetre(0,0,800,500);
|
|
|
|
while(go_on)
|
|
{
|
|
if (ToucheEnAttente() == 1)
|
|
{
|
|
switch (Touche())
|
|
{
|
|
case XK_Up:
|
|
printf("Touche haut\n");
|
|
break;
|
|
case XK_Down:
|
|
printf("Touche bas\n");
|
|
break;
|
|
case XK_Left:
|
|
printf("Touche gauche\n");
|
|
break;
|
|
case XK_Right:
|
|
printf("Touche droite\n");
|
|
break;
|
|
|
|
default:
|
|
printf("Autre touche\n");
|
|
break;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (Microsecondes()>suivant)
|
|
{
|
|
n++;
|
|
suivant=Microsecondes()+delta;
|
|
}
|
|
}
|
|
}
|
|
return EXIT_SUCCESS;
|
|
} |