Friday, July 31, 2009

Vertical lines in C++, using line(); function?

Okay, I know I have to use the line function in graphics in order to create lines. The format for that is (number here, other number here, variable here, another variable here).


If anyone could describe what each value right there means, in the program, it would help immensly.


Here's an example:





setcolor(getmaxcolor());


xmax1 = 322;


ymax1 = 0;





line(322, 1000, xmax1, ymax1);





Any help would be nice. Thanks :D

Vertical lines in C++, using line(); function?
the argument in setcolor(getmaxcolor()); sets the current drawing color to the maximun color in your selected color palete.





the format in line(x1,y1,x2,y2) is as it follows:


You have a rectangular coordinate system in your screen,


the firs two argument are the origin of the line (x1,y1), the next two arguments are the destination (x2,y2), if you put a single point in those coordinates and then join them, you have your line.
Reply:setcolor(getmaxcolor());/* setcolor sets the current drawing color … getmaxcolor returns maximum color value*/





line(322, 1000, xmax1, ymax1); /*draws a line from (x1, y1) to (x2, y2)*/


No comments:

Post a Comment