ct chiant comme d'hab mais jai fait un compte a rebours :)

This commit is contained in:
Simon SAYE BABU 2022-12-06 11:29:23 +01:00
parent d5a3d1d6b9
commit 3fa8a008e9
4 changed files with 87 additions and 0 deletions

28
DEV1.1/TP13/epilepsie.c Normal file
View File

@ -0,0 +1,28 @@
#include <graph.h>
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char const *argv[])
{
FILE *f;
f=fopen("image.bin","r");
int x;
int y;
couleur c;
fread(&x,sizeof(int),1,f);
fread(&y,sizeof(int),1,f);
InitialiserGraphique();
CreerFenetre(10,10,x,y);
for(int i=0;i<x;i++)
{
for(int j=0;j<y;j++)
{
fread(&c,sizeof(unsigned long int),1,f);
ChoisirCouleurDessin(c);
DessinerPixel(i,j);
}
}
Touche();
FermerGraphique();
}

BIN
DEV1.1/TP13/image.bin Normal file

Binary file not shown.

View File

@ -0,0 +1,30 @@
#include <graph.h>
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char const *argv[])
{
FILE *f;
f=fopen("image.bin","r");
int x;
int y;
couleur c;
fread(&x,sizeof(int),1,f);
fread(&y,sizeof(int),1,f);
InitialiserGraphique();
CreerFenetre(10,10,x,y);
fseek(f,(sizeof(unsigned long int)*768*(1024/2)),SEEK_SET);
for(int i=1024/2;i<x;i++)
{
fseek(f,(sizeof(unsigned long int)*(768/2)),SEEK_CUR);
for(int j=768/2;j<y;j++)
{
fread(&c,sizeof(unsigned long int),1,f);
ChoisirCouleurDessin(c);
DessinerPixel(i,j);
}
}
Touche();
FermerGraphique();
}

29
DEV1.1/TP13/rebour.c Normal file
View File

@ -0,0 +1,29 @@
#include <graph.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <unistd.h>
int main(int argc, char const *argv[])
{
int min;
int heure;
printf("rentrez une heure (format: hh mm):\n");
scanf("%d %d",&heure,&min);
InitialiserGraphique();
CreerFenetre(10,10,130,38);
time_t t = time(NULL);
struct tm tm = *localtime(&t);
char tab[8];
couleur c=CouleurParNom("white");
while(5!=0)
{
EffacerEcran(c);
t = time(NULL);
tm = *localtime(&t);
sprintf(tab,"%02d:%02d:%02d",heure-tm.tm_hour,min-tm.tm_min,60-tm.tm_sec);
EcrireTexte(10,30,tab,2);
sleep(1);
}
}