Graphics Test

Does anyone have issues compiling this? It's for a graphics test.
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
#include<graphics.h>
#include<conio.h>
#include<dos.h>

main()
{
   int gd = DETECT, gm, x, y, color, angle = 90;
   struct arccoordstype a, b;
   initgraph(&gd, &gm, "C:\\TC\\BGI");
   delay(2000);
   while(angle<=450)
   {
      setcolor(BLACK);
      arc(getmaxx()/2,getmaxy()/2,angle,angle+2,100);
      setcolor(RED);
      getarccoords(&a);
      circle(a.xstart,a.ystart,25);
      setcolor(BLACK);
      arc(getmaxx()/2,getmaxy()/2,angle,angle+2,150);
      getarccoords(&a);
      setcolor(GREEN);
      circle(a.xstart,a.ystart,25);
      angle = angle+5;
      delay(50);
   }
   getch();
   closegraph();
}
Anyone who isn't using Turbo-C will have problems compiling that code. Almost the entire program is specific to that compiler.
I'm not using it and it works just fine for me. I have code::Blocks with the GNU GCC compiler.
Last edited on
None of those headers are standard headers. Something's weird with your environment. I don't think CodeBlocks has ever supported a version of GCC that supports conio.h out of the box.
The WinBGIm library exists for GCC users to be able to compile old Turbo-C <graphics.h> stuff.
Yeah as far as I know no modern compiler supports <graphics.h> out of the box. To be honest if you are looking to do something with <graphics.h> I would highly suggest you find a more modern library to do it with. That library was mainly bundled with Borland and Turbo-C++ compilers which are over a decade old (90's).

Depending on what you are wanting to do below is a list of some libraries / frameworks that you might be interested in.

GUI Development

- QT ( http://www.qt.io/ )

Can't recommend any others because I have only used QT in depth.

2D Graphics Development

- SFML ( http://www.sfml-dev.org/ )
- SDL ( https://www.libsdl.org/ )

3D Graphics Development

- OpenGL ( https://www.opengl.org/ )
- DirectX ( https://msdn.microsoft.com/en-us/library/windows/apps/hh452744.aspx )
- Orge3D ( http://www.ogre3d.org/ )

Game Development

- Unreal Engine 4 ( https://www.unrealengine.com )
- Unity Engine 5 ( https://unity3d.com/5 )

While Unity is indeed a C# engine mainly I felt it is worth a mention since it one of the very popular free game engines out there.



Anyways check out one of those that suits your needs, there should be no reason to be using <graphics.h> unless you are working with legacy code that can't be changed.
I just wanted to know if anyone else could use the library properly... And I just use it for my own entertainment and for simple game design.
closed account (N36fSL3A)
You'll quickly find that using one of the libraries mentioned above will be much simpler and efficient (both timewise and performance-wise) than using graphics.h.
ok then...
Last edited on
Topic archived. No new replies allowed.