How do I make a graphical drawing move?

Alright I have this :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <iostream>
using namespace std;
#include "win.h"

void main()
{
	AppWindow Win;

	Setup( Win, 0, 0, 200, 200 );
	SetDrawWidth( Win, 5 );
    
  
	SetDrawColor( Win, 1.0, 0.0, 0.0 );
	Line( Win, 100, 50, 100, 150 );

	Line( Win, 50, 70, 100, 100 );
	Line( Win, 100, 100, 150, 70 );

	Line( Win, 50, 180, 100, 150 );
	Line( Win, 150, 180, 100, 150 );
 
	Line( Win, 80, 50, 120 , 50 );
	Line( Win, 80, 15, 120 , 15 );
	Line( Win, 120, 50, 120 , 15 );
	Line( Win, 80, 15, 80 , 50 );

	system( "Pause" );

}


How would I make this animate? Just Move across the screen.

Mainly by itself without user input.
Well, you'll need a function to clear the screen, a loop and variables for the points.
(note I can't help much since I have no idea what library that is)
Last edited on
first draw the line with the color you want to. Then draw the same line with the background color and then draw the line with the wanted color at the new position. clear screen may cause flicker
interesting. . . . .
Topic archived. No new replies allowed.