: : I would appreciate anyone who is well versed with turbo c++ v 3.0 to reply to this post. If you believe you can answer this post otherwise then you are most welcome...!
: :
: : I would like a c or c++ program in which i can make my own colour (in the graphics mode)? And I don't have that much of knowledge of assembly either. So i guess this will be difficult. But do try giving me the required logic/theory behind constructing this program. I guess it would be of great help!!!
: :
:
: hELLO!! Again, I'm john. I want to answer your question regarding on graphics in C.
:
: To make your text color, read this pls.:
:
: sample program:
: ------------------------
: #include<stdio.h> |
: #include<conio.h> |
: #include<graphics.h> |
: main() |
: { |
: clrscr(); |
: printf("\033[2J"); |
: printf("\nHello!!"); |
: getch(); |
: } |
: ------------------------
: /*The example above uses 3 escape characters. The first 0 sets the text mode to 40 colomns and 25 rows . The second 33 sets the foreground text color to yellow. The last [2J clears the screen.*/
:
: The list below shows the escape characters that are supported:
:
:
: /* escape characters used for changig color */
:
: foreground color attributes
:
: 30 black
: 31 red
: 32 green
: 33 yellow
: 34 blue
: 35 magenta
: 36 cyan
: 37 white
:
:
: background color attributes
:
:
: 40 black
: 41 red
: 42 green
: 43 yellow
: 44 blue
: 45 magenta
: 46 cyan
: 47 white
:
:
: /* escape characters used to change text attributes */
:
: 0 switches off all other attributes
: 1 bold text
: 4 underlined text
: 5 blinking text
: 7 invers display
: 8 characters not visible on screen
:
: /* escape characters used to change video mode */
: video mode settings
:
: 0 40 cols, 25 rows, monochrom text
: 1 40 cols, 25 rows, color text
: 2 80 cols, 25 rows, monochrom text
: 3 80 cols, 25 rows, color text
:
:
: 4 320*200 pxl, screen resolution, multi-color
: 5 320*200 pxl, monochrom graphics
: 6 640*200 pxl, monchrom graphics
: 7 characters at the end of a line will be taken to next line
:
:
: 13 320*200 pxl screen resolution, color graphics
: 14 640*200 pxl 16 color graphics
: 15 640*350 pxl monochrom graphics (2 color)
: 16 640*350 pxl 16 color graphics
: 17 640*480 pxl monochrom graphics (2 color)
: 18 640*480 pxl 16 bit color
: 19 320*200 pxl 256 color graphics
:
: Did you get it? If not, pleasepost your questions again in the message board. Thanks. ☺ ☺ ☺
:
:
Dear John,
I tried that code but my output is not what you claim it is!!
The output goes something like an arrow followed by the "[2J"
and in the next line "Hello!!"
This might be an exaggerated output below:
<-[2J
Hello!!
Can this be the problem of the version I use - Turbo C++ Version 3.0?
And I was thinking creating my own color...? I was expecting you would give me a code that initializes the graphics screen and everything (the initgraph() ). I am aware of the setcolor() function. But I can only get predefined colors!!! Yellow has the number 14; so:-
setcolor(14);
...should make any thing coming after that instruction yellow.
What do I do if I need (say) gold or silver color? In windows you have the RGB specification. Is there something similiar?