Ajout des travaux effectuer
This commit is contained in:
BIN
23DEV1.1/SAE/1-SAE/Snake
Executable file
BIN
23DEV1.1/SAE/1-SAE/Snake
Executable file
Binary file not shown.
49
23DEV1.1/SAE/1-SAE/Snake.c
Normal file
49
23DEV1.1/SAE/1-SAE/Snake.c
Normal file
@@ -0,0 +1,49 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <graph.h>
|
||||
#include <time.h>
|
||||
|
||||
void graphique(){
|
||||
int point = 0;
|
||||
int n = 0;
|
||||
InitialiserGraphique();
|
||||
CreerFenetre(1700,950,1700,950);
|
||||
couleur c, r, e;
|
||||
r=CouleurParComposante(0,0,0);
|
||||
ChoisirCouleurDessin(r);
|
||||
RemplirRectangle(0,0,1700,950);
|
||||
c=CouleurParComposante(111,255,94);
|
||||
ChoisirCouleurDessin(c);
|
||||
RemplirRectangle(17,20,1670,850);
|
||||
temps(n);
|
||||
Touche();
|
||||
FermerGraphique();
|
||||
}
|
||||
//1 = pomme ; 2 = mur ; 3 = corps du serpent
|
||||
//deplacement du serpent
|
||||
//detection des obstacles
|
||||
//temps de jeu
|
||||
//score du jeu
|
||||
int score(int ab){
|
||||
ab++;
|
||||
return ab;
|
||||
}
|
||||
|
||||
void temps(int n){
|
||||
couleur f;
|
||||
unsigned long suivant;
|
||||
char buf[100];
|
||||
while(1){
|
||||
if (Microsecondes()>suivant){
|
||||
n++;
|
||||
f=CouleurParNom("white");
|
||||
ChoisirCouleurDessin(f);
|
||||
snprintf(buf,100,"Temps : %05d", n);
|
||||
}
|
||||
}
|
||||
}
|
||||
int main(int argc, char const *argv[])
|
||||
{
|
||||
graphique();
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
BIN
23DEV1.1/SAE/1-SAE/Test
Executable file
BIN
23DEV1.1/SAE/1-SAE/Test
Executable file
Binary file not shown.
37
23DEV1.1/SAE/1-SAE/Test.c
Normal file
37
23DEV1.1/SAE/1-SAE/Test.c
Normal file
@@ -0,0 +1,37 @@
|
||||
#include <graph.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#define DELTA 1000000L;
|
||||
|
||||
void DessinerScene(int n) {
|
||||
couleur c;
|
||||
char buf[100];
|
||||
c = CouleurParNom("white");
|
||||
ChoisirCouleurDessin(c);
|
||||
RemplirRectangle(0,0,100,100);
|
||||
c = CouleurParNom("black");
|
||||
ChoisirCouleurDessin(c);
|
||||
snprintf(buf, 100, "Temps : %05d", n);
|
||||
EcrireTexte(10,20,buf,0);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int n;
|
||||
couleur c;
|
||||
unsigned long suivant;
|
||||
InitialiserGraphique();
|
||||
CreerFenetre(10,10,800,500);
|
||||
n = 0;
|
||||
suivant = Microsecondes()+DELTA;
|
||||
while(1){
|
||||
if(Microsecondes()>suivant) {
|
||||
n++;
|
||||
DessinerScene(n);
|
||||
suivant = Microsecondes()+DELTA;
|
||||
}
|
||||
}
|
||||
Touche();
|
||||
FermerGraphique();
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
Reference in New Issue
Block a user