// Simple animation (somewhat slow and flickery) #include "GraphicsMagician.h" int main() { Machine.Start(); // x and y location of the "bouncing ball" int x = 20, y = 300; // the amount we'll add to x each time around the loop int dx = 10; // draw a yellow circle, then pause for a keypress Machine.Circle(x,y,10,RGB(255,255,0),1); getch(); // loop until the user presses ESC or closes the window while (Machine.Active()) { // erase the circle at its old location Machine.Circle(x,y,10,RGB(0,0,0),1); // change the x location x=x+dx; // bounce if at the left or right edge of the window if (x > 796 || x < 5) { dx = -dx; Machine.PlayWave("bounce.wav"); } // and draw the yellow circle at its new location Machine.Circle(x,y,10,RGB(255,255,0),1); } return 0; }