Add Graphic Background A Application Dev C++
Hi pals,
I am a Newbie in C++ Programming field. I plan to add graphics.h header class in
Dev -C++ Version 4.9.9.2 from Bloodshed which is come along with Borland Compiler.
I follow the Steps in URL : http://www.uniqueness-template.com/devcpp/#step2
But I Got Error in the Sample code which test the Working , Please Help me
to get away from this problem . I am waiting to hear from you.
Regards
Anes P.A:'(
- 13 Contributors
- forum 14 Replies
- 19,262 Views
- 5 Years Discussion Span
- commentLatest Postby leonesaLatest Post
How do you add a background image in c? I use dev-c as my compiler and i don't know how to add a background image instead of having it just black. I can do graphics in Dev- C. I am using Dev-C.:). Just follow the instructions carefully and do not forget to put linkers. You can't do a graphics by making a new source file. You need to do a new project to put linkers. Yes, but you are not using the 16-bit functions that are. There are 16 colors declared in C Graphics. We use colors to set the current drawing color, change the color of background, change the color of text, to color a closed shape etc. To specify a color, we can either use color constants like setcolor(RED), or their corresponding integer codes like setcolor(4). Below is the color code in increasing.
Graphics In Dev C++ Download
WaltP2,905
Dev C++ Graphics Tutorial
You can't. graphics.h is not compatible with Dev-C++
Dev C++ Graphics Code
The wrong way:
system('color fc');
sets text color as red and background color as white. Note that color will be changed i the whole console. Also, system isn't quite save. The windows way:
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0xfc);
same color, but now, only text printed after this function was called will be colored. This allows multiple colors.edit:
And now I'll explain how the colors work. You'll probably just google which color is which, but you migt find this interesting. Attribute is kept in a byte. 4 bits for background and 4 for text color. To represent this color hexadecimal numbers are used, since one hex digit represents 4 bits. For example 0x07. 0 is background color (black) and 7 is text color (gray).
If you write the 4 bits in binary they represent red, green and blue components. The first bit indicates whether the color is bright or dark.
examples:
0100 -> 0x4 -> dark red
1100 -> 0xC -> bright red
0111 -> 0x7 -> dark white (gray)
1000 -> 0x8 -> bright black (also gray, but slightly darker)
1101 -> 0xD -> bright purple
0001 -> 0x1 -> dark blue
and so on...
If you want a complete list of colors. A good place to find it is to write 'help color' in cmd.