Préparations Initialisation Serpent + Améliorations gen_pastille()
This commit is contained in:
50
Test_Touches.c
Normal file
50
Test_Touches.c
Normal file
@@ -0,0 +1,50 @@
|
||||
#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;
|
||||
}
|
||||
Reference in New Issue
Block a user