Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get and use the header file <graphics.h> in my C++ program?

Tags:

I have been searching to get the source code of the header file <graphics.h> and its associated library in order to integrate it with my C++ program.

At the same time, I am interested in those cross-platform libraries that works on more than one compiler. Just to be more explicit, I am talking about those libraries that are used for drawing shapes, lines, and curves in C++.

like image 970
CompilingCyborg Avatar asked Oct 22 '11 15:10

CompilingCyborg


2 Answers

<graphics.h> is very old library. It's better to use something that is new

Here are some 2D libraries (platform independent) for C/C++

SDL

GTK+

Qt

Also there is a free very powerful 3D open source graphics library for C++

OGRE

like image 53
ammar26 Avatar answered Oct 01 '22 09:10

ammar26


<graphics.h> is not a standard header. Most commonly it refers to the header for Borland's BGI API for DOS and is antiquated at best.

However it is nicely simple; there is a Win32 implementation of the BGI interface called WinBGIm. It is implemented using Win32 GDI calls - the lowest level Windows graphics interface. As it is provided as source code, it is perhaps a simple way of understanding how GDI works.

WinBGIm however is by no means cross-platform. If all you want are simple graphics primitives, most of the higher level GUI libraries such as wxWidgets and Qt support that too. There are simpler libraries suggested in the possible duplicate answers mentioned in the comments.

like image 33
Clifford Avatar answered Oct 01 '22 09:10

Clifford