Moving a circle in C graphics on Visual Studio

I really need help guys.. I started C++ yesterday.. managed to make a circle.. How do I move it? ( I need to make a simulation of acceleration.)
1
2
3
4
5
6
7
8
9
10
11
#include "graphics.h"
#include "winbgim.h"

void main()
{
	initwindow(1080, 720);

	circle(100, 100, 50);

	getch();
}
Draw the circle again but with the backgroundcolor to delete it. Then draw it on a different location.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
void main(void)
{
  int x = 100, y = 100, radius = 50;

  initwindow(1080, 720);
  setcolor(GREEN);
  while (!kbhit())
  {
    circle(x, y, radius);
    delay(200);
    setcolor(BLACK);
    circle(x, y, radius);
    x += 10;
    setcolor(GREEN);
    circle(x, y, radius);
  }
	
}


Play around a bit with the delay and move distance.
I started C++ yesterday.. managed to make a circle

If you just started C++ then I suggest you find a modern compiler and a modern graphics package. That graphics package you're using is so outdated it should be abandoned.
Last edited on
jlb:
That graphics package you're using is so outdated it should be abandoned.


WinBGI is from 2004 - is this really so outdated?
Can you recommend a more modern and easy-to-use graphics package?
Yes, it is outdated, 2004 is a long time ago when talking about computer graphics programs. Also this started as a partial hack of the Borland DOS BGI graphics library that had become outdated.

You can look into SDL, OpenGL, Glew, to name a few.
https://en.wikipedia.org/wiki/Graphics_library
https://en.wikipedia.org/wiki/List_of_3D_graphics_libraries

But since the OP stated that he is just starting his C/C++ programming journey I would recommend staying away from graphics until he masters the core language.

Topic archived. No new replies allowed.