Home > OS >  What to use when drawing shapes in C?
What to use when drawing shapes in C?

Time:12-02

I've been having some problems trying to figure out with header is useful to manage to get a screen, and draw shapes in it, using C.

Tried to use 'graphics.h' but is not working for me, I think maybe 'graphics.h' is meant to be used in C and not C? I really don't know and would appreciate it if someone knows anything.

CodePudding user response:

On Linux, you can't build a graphical app using only stdlib. You have to add something like OpenGL, Xlib, maybe Qt or even SFML. Good luck to make an app)

CodePudding user response:

I believe graphics.h is a Windows-specific library. Assuming you're on Linux, you can use gfx.

gfx is an xlib-based graphics library with some very basic functions to draw lines/pixels and get keyboard input. I wouldn't use it in a serious project, but it's fairly easy to get started with. You can even add functionality to draw more complex shapes if you mess with the source code and some XLib functions.

If that's too basic, you can use SDL2 for 2D graphics, OpenGL for 3D graphics, and ncurses for terminal-based graphics.

  • Related