Git clean
This commit is contained in:
parent
b637d047c9
commit
70d625c5c1
@ -1,50 +0,0 @@
|
|||||||
#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;
|
|
||||||
}
|
|
@ -1,59 +0,0 @@
|
|||||||
#include<stdio.h>
|
|
||||||
#include<stdlib.h>
|
|
||||||
#include<graph.h>
|
|
||||||
#define delta 1000000L
|
|
||||||
|
|
||||||
void DessinerScene(int sprite,int x,int y,int n)
|
|
||||||
{
|
|
||||||
char buf[100];
|
|
||||||
ChoisirEcran(1);
|
|
||||||
CopierZone(2,1,0,0,800,500,0,0);
|
|
||||||
snprintf(buf,100,"temps : %05d",n);
|
|
||||||
EcrireTexte(10,20,buf,0);
|
|
||||||
AfficherSprite(sprite,x,y);
|
|
||||||
CopierZone(1,0,0,0,800,500,0,0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
int pingouin;
|
|
||||||
int x,y,old_x,old_y;
|
|
||||||
int n;
|
|
||||||
unsigned long suivant;
|
|
||||||
int go_on=1;
|
|
||||||
|
|
||||||
InitialiserGraphique();
|
|
||||||
CreerFenetre(0,0,800,500);
|
|
||||||
ChoisirEcran(2);
|
|
||||||
ChargerImageFond("./images/arctis2.jpg");
|
|
||||||
pingouin=ChargerSprite("./images/walk-0.png");
|
|
||||||
x=y=old_x=old_y=10;
|
|
||||||
n=0;
|
|
||||||
DessinerScene(pingouin,x,y,0);
|
|
||||||
suivant=Microsecondes()+delta;
|
|
||||||
|
|
||||||
while(go_on)
|
|
||||||
{
|
|
||||||
if (SourisCliquee()) go_on=0;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (Microsecondes()>suivant)
|
|
||||||
{
|
|
||||||
n++;
|
|
||||||
DessinerScene(pingouin,x,y,n);
|
|
||||||
suivant=Microsecondes()+delta;
|
|
||||||
}
|
|
||||||
SourisPosition();
|
|
||||||
x=_X;
|
|
||||||
y=_Y;
|
|
||||||
if (x!=old_x || y!=old_y)
|
|
||||||
{
|
|
||||||
DessinerScene(pingouin,x,y,n);
|
|
||||||
old_x=x;
|
|
||||||
old_y=y;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
FermerGraphique();
|
|
||||||
}
|
|
||||||
|
|
Binary file not shown.
Before ![]() (image error) Size: 18 KiB |
Binary file not shown.
Before ![]() (image error) Size: 4.9 KiB |
BIN
test
BIN
test
Binary file not shown.
45
test.c
45
test.c
@ -1,45 +0,0 @@
|
|||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#define TAILLE 20
|
|
||||||
|
|
||||||
/* Fonction pour afficher un tableau de coordonnées */
|
|
||||||
void afficherSerpent(int serpent[], int taille) {
|
|
||||||
int i = 0;
|
|
||||||
for (i = 0; i < taille; i += 2) {
|
|
||||||
printf("(%d, %d) ", serpent[i], serpent[i + 1]);
|
|
||||||
}
|
|
||||||
printf("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Fonction pour décaler chaque paire d'éléments (x, y) du tableau vers la droite */
|
|
||||||
void decalerSerpent(int serpent[], int taille) {
|
|
||||||
int tempX = serpent[0];
|
|
||||||
int tempY = serpent[1];
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 2; i < taille; i += 2) {
|
|
||||||
int tempX2 = serpent[i];
|
|
||||||
int tempY2 = serpent[i + 1];
|
|
||||||
|
|
||||||
serpent[i] = tempX;
|
|
||||||
serpent[i + 1] = tempY;
|
|
||||||
|
|
||||||
tempX = tempX2;
|
|
||||||
tempY = tempY2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int main() {
|
|
||||||
int serpent[TAILLE] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20};
|
|
||||||
|
|
||||||
printf("Serpent initial : ");
|
|
||||||
afficherSerpent(serpent, TAILLE);
|
|
||||||
|
|
||||||
/* Décaler le serpent d'une paire d'éléments vers la droite */
|
|
||||||
decalerSerpent(serpent, TAILLE);
|
|
||||||
|
|
||||||
printf("Serpent après décalage : ");
|
|
||||||
afficherSerpent(serpent, TAILLE);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
BIN
testpinguin
BIN
testpinguin
Binary file not shown.
13
touche.c
13
touche.c
@ -1,13 +0,0 @@
|
|||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <graph.h>
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
if(Touche() == "XK_Left")
|
|
||||||
{
|
|
||||||
EcrireTexte(100,200,"Touché !",2);
|
|
||||||
ToucheEnAttente();
|
|
||||||
}
|
|
||||||
return EXIT_SUCCESS;
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user