This commit is contained in:
2023-11-20 15:04:12 +01:00
parent e9ee361110
commit 2cd58909df
11 changed files with 391 additions and 0 deletions

48
archive/Decouverte.c Normal file
View File

@@ -0,0 +1,48 @@
#include<stdlib.h>
#include<stdio.h>
#include<graph.h>
#include<time.h>
#define H 40
#define L 60
int main(void){
/*partie graphique*/
InitialiserGraphique();
CreerFenetre(10,10,1700,1000);
couleur c;
c=CouleurParNom("green");
ChoisirCouleurDessin(c);
int tab[H][L];
int i,j,posx=0,posy=0;
for(i=0;i<H;i++){
for(j=0;j<L;j++){
tab[i][j]=0;
}
}
for(i=0;i<H;i++){
for(j=0;j<L;j++){
if(tab[i][j]==0){
c=CouleurParNom("green");
ChoisirCouleurDessin(c);
RemplirRectangle(posx,posy,20,20);
}
posx=posx+20;
}
posx=0;
posy=posy+20;
}
posx=0;
posy=0;
c=CouleurParNom("yellow");
ChoisirCouleurDessin(c);
for(i=0;i<10;i++){
RemplirRectangle(posx,20,20,20);
posx=posx+20;
}
while(1){
}
}

70
archive/STime.c Normal file
View File

@@ -0,0 +1,70 @@
#include<stdlib.h>
#include<stdio.h>
#include<graph.h>
#include<time.h>
#define H 40
#define L 60
#define DELTA 1000000L ;
void DessinerScene(int n)
{
couleur c;
char buf[100];
c=CouleurParNom("white");
ChoisirCouleurDessin(c);
RemplirRectangle(0,850,200,100);
c=CouleurParNom("black");
ChoisirCouleurDessin(c);
snprintf(buf,100,"time : %d",n);
EcrireTexte(50,900,buf,2);
}
int main(void){
/*partie graphique*/
InitialiserGraphique();
CreerFenetre(10,10,1700,1000);
couleur c;
c=CouleurParNom("green");
ChoisirCouleurDessin(c);
int tab[H][L];
int i,j,posx=0,posy=0,n=0;
unsigned long suivant;
suivant=Microsecondes()+DELTA;
for(i=0;i<H;i++){
for(j=0;j<L;j++){
tab[i][j]=0;
}
}
for(i=0;i<H;i++){
for(j=0;j<L;j++){
if(tab[i][j]==0){
c=CouleurParNom("green");
ChoisirCouleurDessin(c);
RemplirRectangle(posx,posy,20,20);
}
posx=posx+20;
}
posx=0;
posy=posy+20;
}
posx=0;
posy=0;
c=CouleurParNom("yellow");
ChoisirCouleurDessin(c);
for(i=0;i<10;i++){
RemplirRectangle(posx,20,20,20);
posx=posx+20;
}
while(1){
if (Microsecondes()>suivant)
{
n++;
DessinerScene(n);
suivant=Microsecondes()+DELTA;
}
}
}

69
archive/TestFinProg.c Normal file
View File

@@ -0,0 +1,69 @@
#include<stdlib.h>
#include<stdio.h>
#include<graph.h>
#include<time.h>
#define H 40
#define L 60
#define DELTA 1000000L ;
void DessinerScene(int n)
{
couleur c;
char buf[100];
c=CouleurParNom("white");
ChoisirCouleurDessin(c);
RemplirRectangle(0,850,200,100);
c=CouleurParNom("black");
ChoisirCouleurDessin(c);
snprintf(buf,100,"time : %d",n);
EcrireTexte(50,900,buf,2);
}
int main(void){
/*partie graphique*/
InitialiserGraphique();
CreerFenetre(10,10,1700,1000);
couleur c;
c=CouleurParNom("green");
ChoisirCouleurDessin(c);
int tab[H][L];
int i,j,posx=0,posy=0,n=0;
unsigned long suivant;
suivant=Microsecondes()+DELTA;
for(i=0;i<H;i++){
for(j=0;j<L;j++){
tab[i][j]=0;
}
}
while(1){
if (Microsecondes()>suivant)
{
n++;
DessinerScene(n);
suivant=Microsecondes()+DELTA;
}
for(i=0;i<H;i++){
for(j=0;j<L;j++){
if(tab[i][j]==0){
c=CouleurParNom("green");
ChoisirCouleurDessin(c);
RemplirRectangle(posx,posy,20,20);
}
if(tab[i][j]==1){
c=CouleurParNom("yellow");
ChoisirCouleurDessin(c);
RemplirRectangle(posx,posy,20,20);
}
posx=posx+20;
}
posx=0;
posy=posy+20;
}
posx=0;
posy=0;
}
}

48
archive/Timer.c Normal file
View File

@@ -0,0 +1,48 @@
#include<stdlib.h>
#include<graph.h>
#include<stdio.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()
{
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;
}