Académique Documents
Professionnel Documents
Culture Documents
h>
void waitForLeftMouseClick();
int main()
{
initwindow(1000,1000); //open a 400x300 graphics window
// delete these lines and replace them with your own code:
rectangle(100,100,900,600);
rectangle(50,50,950,650);
for(int i=0;i<=730;i++)
{
setfillstyle(0,3);
fillellipse(130+i,350,25,25);
delay(10);
cleardevice();
rectangle(100,100,900,600);
rectangle(50,50,950,650);
}
for(int i=750;i>=0;i--)
{
setfillstyle(1,3);
fillellipse(130+i,350,25,25);
delay(10);
cleardevice();
rectangle(100,100,900,600);
rectangle(50,50,950,650);
}
// while(!kbhit()); // wait for user to press a key
waitForLeftMouseClick(); // use one or the other of these--not both
void waitForLeftMouseClick()
{
clearmouseclick(WM_LBUTTONDOWN);
const int DELAY = 50; // Milliseconds of delay between checks
int x, y;
while (!ismouseclick(WM_LBUTTONDOWN))
delay(DELAY);
getmouseclick(WM_LBUTTONDOWN, x, y);
}