64 lines
970 B
C
64 lines
970 B
C
#include <graph.h>
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
|
|
void carre(int x,int y)
|
|
{
|
|
DessinerSegment(x-25,y-25,x+25,y-25);
|
|
DessinerSegment(x+25,y-25,x+25,y+25);
|
|
DessinerSegment(x+25,y+25,x-25,y+25);
|
|
DessinerSegment(x-25,y+25,x-25,y-25);
|
|
}
|
|
|
|
void cercle(int x,int y)
|
|
{
|
|
couleur c;
|
|
c=CouleurParComposante(0,255,0);
|
|
ChoisirCouleurDessin(c);
|
|
RemplirArc(x-30,y-30,60,60,0,360);
|
|
}
|
|
|
|
void txtface(int x, int y)
|
|
{
|
|
couleur c;
|
|
c=CouleurParComposante(255,0,255);
|
|
ChoisirCouleurDessin(c);
|
|
EcrireTexte(x-25,y+7,">o<",2);
|
|
}
|
|
|
|
|
|
|
|
|
|
int main(int argc, char const *argv[])
|
|
{
|
|
InitialiserGraphique();
|
|
CreerFenetre(10,10,480,270);
|
|
int touche;
|
|
while(touche!=XK_space)
|
|
{
|
|
touche=Touche();
|
|
SourisPosition();
|
|
if(touche==XK_a)
|
|
{
|
|
carre(_X,_Y);
|
|
}
|
|
if(touche==XK_z)
|
|
{
|
|
cercle(_X,_Y);
|
|
}
|
|
if(touche==XK_e)
|
|
{
|
|
txtface(_X,_Y);
|
|
}
|
|
if(touche==XK_r)
|
|
{
|
|
ChargerImage("exercices_cercles.png",_X-45,_Y+15,0,0,103,36);
|
|
}
|
|
}
|
|
FermerGraphique();
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
} |