Amelioration code + commentaires. Rectifications erreurs etc.
This commit is contained in:
58
main.c
58
main.c
@@ -2,7 +2,7 @@
|
||||
#include <stdio.h>
|
||||
#include <graph.h>
|
||||
#include <time.h>
|
||||
#include "evenement.h"
|
||||
#include "evenements.h"
|
||||
#include "main.h"
|
||||
#include "gui.h"
|
||||
#include "scene.h"
|
||||
@@ -114,12 +114,57 @@ int main()
|
||||
|
||||
while(game_on) /* Lancement du cycle pour les Inputs et le Jeu*/
|
||||
{
|
||||
if(Touches(&direction,&direction_davant,&pause))
|
||||
if (ToucheEnAttente() == 1)
|
||||
{
|
||||
FinJeu(serpent,pastilles,obstacle);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
switch (Touche())
|
||||
{
|
||||
case XK_Up:
|
||||
direction = 1;
|
||||
if(direction_davant == 3 && direction == 1)
|
||||
{
|
||||
direction = direction_davant;
|
||||
}
|
||||
break;
|
||||
case XK_Down:
|
||||
direction = 3;
|
||||
if(direction_davant == 1 && direction == 3)
|
||||
{
|
||||
direction = direction_davant; /* Changements de direction du serpent */
|
||||
}
|
||||
break;
|
||||
case XK_Left:
|
||||
direction = 0;
|
||||
if(direction_davant == 2 && direction == 0)
|
||||
{
|
||||
direction = direction_davant;
|
||||
}
|
||||
break;
|
||||
case XK_Right:
|
||||
direction = 2;
|
||||
if(direction_davant == 0 && direction == 2)
|
||||
{
|
||||
direction = direction_davant;
|
||||
}
|
||||
break;
|
||||
case XK_space:
|
||||
if(pause ==0)
|
||||
{
|
||||
pause=1;
|
||||
break;
|
||||
}
|
||||
pause=0;
|
||||
break;
|
||||
|
||||
case XK_Escape:
|
||||
if(pause == 1)
|
||||
{
|
||||
FinJeu(serpent,pastilles,obstacle);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(pause==1)
|
||||
{
|
||||
Pause();
|
||||
@@ -161,5 +206,4 @@ int main()
|
||||
}
|
||||
FinJeu(serpent,pastilles,obstacle);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user