How to draw a line, a rectangle and a circle with C?

Started by
11 comments, last by Cinnamon 21 years, 7 months ago
SDL is a 2d libary that is cross platform. You can use it to plot stuff to the screen and so create circles etc. It also has sound and input functions.

DX is a libary for windows that does just about everything you could need for your game. It has input compoents, sound components, network components, 3d components as well as drawiing components. The drawing side is what you''d want to use. It''s called direct draw.

OpenGL is a cross platform 3d libary. it''s only for 3d and nothing else it''s very popular. The quake3 engine uses it
Advertisement
It seems that you''re still confused. A library is essentially a set of functions that you can use in your programs, but is NOT part of the language. To use a library, you need to link the library''s files to your project, and then you can use the functions in your C code.

The only reasonable way to even plot pixels is to use a separate library. Trying to find your video memory and writing to it with pure C would be pointless and very complicated.

I suggest you learn non-graphics C before you start with any graphics library. It really helps to have a reasonable knowledge of the language before you try to do something complicated with it.
quote:Original post by micepick
It seems that you''re still confused. A library is essentially a set of functions that you can use in your programs, but is NOT part of the language.


To clarify this - a library might be written using C or C++ (very likely) and it might be written to be used with C or C++. The "NOT part of the language" description comes about because the library hasn''t been formally included in the language specification. The International Standards Organization (ISO) defines a standard definition for these languages. The process involves people in many different countries and takes many years to finalize a specification. Compiler writers use this specification when writing their compilers (we hope), since the standard defines the language.

There are a set of functions that the standard does define. On Windows you''ll find many of these functions in crtdll.dll and msvcrt.dll. This library is called the "runtime library" and it is part of the language. C++ also has a "standard template library" - but you probably won''t need to concern yourself with templates for several months.

So the bit about a library not being part of the language pertains to every library except the runtime library. That means DirectX, OpenGl, Simple Direct Media (SDL) and so on.
"I thought what I'd do was, I'd pretend I was one of those deaf-mutes." - the Laughing Man

This topic is closed to new replies.

Advertisement