color objects in C or C ++ [closed]
- by jazz
Possible Duplicate:
Colors in C language
i copied a game from a book which name is paratrooper i ask this question again i also provide the code of the objects which i create there i want to change the color of these objects but i didn't understand how to do that so can any one plz help me how to do that.Listen guys they are not the standard functions but i use the graphics library for these functions and i can't find the function in the library file of graphics. i hope u understand know.this code will not run properly so plz tell me something about the function which color it i can't put the image other wize i show u the image it will make alot easieer
#include "graphics.h"
#include "stdio.h"
#include "conio.h"
#include "process.h"
#include "alloc.h"
#include "stdlib.h"
#include "math.h"
#include "dos.h"
main()
{
int gm=CGAHI, gd=CGA, key=0, area;
initgraph(&gd, &gm, "C:\\tc\\bgi");
helidraw(246,50,-1);
getch();
return 0;
}
helidraw ( int x, int y, int d )
{
int direction, i, j ;
if ( d )
direction = -1 ;
else
direction = 1 ;
i = 3 ;
j = 8 ;
line ( x - j - 8, y - i - 2, x + j + 8, y - i - 2 ) ;
line ( x - j + 5, y - i - 1, x + j - 5, y - i - 1 ) ;
line ( x - j, y - i, x + j, y - i ) ;
for ( ; i > 0 ; i--, j += 2 )
{
putpixel ( x - ( direction * j ), y - i, 1 ) ;
line ( x + ( direction * j ), y - i, x + ( direction * ( j - 8 ) ), y - i ) ;
}
i = 0 ;
j -= 2 ;
line ( x - ( direction * j ), y - i, x - ( direction * ( j + 17 ) ), y - i ) ;
line ( x - ( direction * j ), y - i + 1, x - ( direction * ( j + 7 ) ), y - i + 1 ) ;
putpixel ( x - ( direction * ( j + 19 ) ), y - i - 1, 1 ) ;
for ( ; i < 3 ; i++, j -= 2 )
{
putpixel ( x - j, y + i, 1 ) ;
putpixel ( x + j, y + i, 1 ) ;
}
line ( x - j, y + i, x + j, y + i ) ;
putpixel ( x - j + 3, y + i + 1, 1 ) ;
putpixel ( x + j - 3, y + i + 1, 1 ) ;
line ( x - j - 10, y + i + 2, x + j + 10, y + i + 2 ) ;
putpixel ( x + ( direction * ( j + 12 ) ), y + i + 1, 1 ) ;
}