72 lines
1.5 KiB
C
72 lines
1.5 KiB
C
#include <graph.h>
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
|
|
struct mail {
|
|
unsigned char r;
|
|
unsigned char v;
|
|
unsigned char b;
|
|
struct mail* suivant;
|
|
};
|
|
|
|
typedef struct mail maillon;
|
|
|
|
void txt(int x, int y,char texte[],maillon* rainbow)
|
|
{
|
|
char *ptr;
|
|
|
|
couleur c;
|
|
for (int i = 0; i < strlen(texte); ++i)
|
|
{
|
|
*ptr = texte[i];
|
|
c=CouleurParComposante(rainbow->r,rainbow->v,rainbow->b);
|
|
ChoisirCouleurDessin(c);
|
|
EcrireTexte(x,y,ptr,2);
|
|
rainbow=rainbow->suivant;
|
|
x+=TailleChaineEcran(ptr,2);
|
|
}
|
|
}
|
|
|
|
maillon* ajouter_debut(maillon* premier,unsigned char rouge,unsigned char vert,unsigned char bleu)
|
|
{
|
|
maillon* p = (maillon*) malloc(sizeof(maillon));
|
|
if (p)
|
|
{
|
|
p->suivant = premier;
|
|
p->r = rouge;
|
|
p->v = vert;
|
|
p->b = bleu;
|
|
}
|
|
return p;
|
|
}
|
|
|
|
int main(int argc, char const *argv[])
|
|
{
|
|
maillon *rainbow = malloc(sizeof(maillon));
|
|
|
|
rainbow->r = 255;
|
|
rainbow->v = 0;
|
|
rainbow->b = 0;
|
|
maillon* end;
|
|
end = rainbow;
|
|
rainbow = ajouter_debut(rainbow,255,144,0);
|
|
rainbow = ajouter_debut(rainbow,255,255,50);
|
|
rainbow = ajouter_debut(rainbow,0,235,30);
|
|
rainbow = ajouter_debut(rainbow,0,255,240);
|
|
rainbow = ajouter_debut(rainbow,0,81,255);
|
|
rainbow = ajouter_debut(rainbow,136,0,255);
|
|
rainbow = ajouter_debut(rainbow,220,0,255);
|
|
rainbow = ajouter_debut(rainbow,255,0,144);
|
|
end ->suivant = rainbow;
|
|
|
|
char blablabla[1]="AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
|
|
|
|
InitialiserGraphique();
|
|
CreerFenetre(10,10,1000,270);
|
|
txt(200,135,blablabla,rainbow);
|
|
Touche();
|
|
FermerGraphique();
|
|
|
|
return 0;
|
|
} |