Ecran de veille

omar -  
 mimo -
voila un ecran de veille sous windows en c et je veux le dévelopé alors merci pour vos commentaire
#include <conio.h>
#include <graphics.h>
#include <stdlib.h>
#include <time.h>
#include <dos.h>

typedef struct
{
int x, y, r;
}
data_s;

/* ---------------------------- */
void initialise (data_s * this)
{
int pilote, mode;
pilote = DETECT;
initgraph (&pilote, &mode, "d:\\bc\\bgi");
this->x = 100;
this->y = 200;
this->r = 50;
circle (this->x, this->y, this->r);
}

/* --------------------------------- */
void deplace_cercle_droite (data_s * this)
{
setcolor (BLACK), circle (this->x, this->y, this->r);
this->x++;
if (this->x == getmaxx ())
this->x = 0;
setcolor (WHITE);
circle (this->x, this->y, this->r);

}

/* --------------------------------- */
void deplace_cercle_gauche (data_s * this)
{
setcolor (BLACK), circle (this->x, this->y, this->r);
if (this->x > 0)
{
this->x--;
}
else
{
this->x = getmaxx () - 1;
}
setcolor (WHITE);
circle (this->x, this->y, this->r);
}

/* --------------------------------- */
void deplace_cercle_haut (data_s * this)
{
setcolor (BLACK), circle (this->x, this->y, this->r);
if (this->y > 0)
{
this->y--;
}
else
{
this->y = getmaxy () - 1;
}
setcolor (WHITE);
circle (this->x, this->y, this->r);
}

/* --------------------------------- */
void deplace_cercle_bas (data_s * this)
{
setcolor (BLACK), circle (this->x, this->y, this->r);
this->y++;
if (this->y == getmaxy ())
this->y = 0;
setcolor (WHITE);
circle (this->x, this->y, this->r);
}

/* --------------------------------- */
int main (void)
{
data_s data;
randomize ();
initialise (&data);
for (;;)
{
if (kbhit ())
{
int touche = getch ();
if (touche == 27)
{
break;
}
}

delay (10);

{
int x = random (4);
switch (x)
{
case 0:
deplace_cercle_droite (&data);
break;
case 1:
deplace_cercle_gauche (&data);
break;
case 2:
deplace_cercle_haut (&data);
break;
case 3:
deplace_cercle_bas (&data);
break;
}
}
}
closegraph ();
return 0;
}
A voir également:

1 réponse

mimo
 
ben si tu fait ca il te faut un compilateur comme ce lui la
http://www.developpez.net/forums/viewforum.php?f=6 si tu le compile tauras un ecran cool pas mal la source
0