User Tools

Site Tools


c:graphics.h:linerel

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

c:graphics.h:linerel [2015/05/06 23:06] (current)
Line 1: Line 1:
 +===== linerel =====
 +
 +
 +====Syntax of linerel ==== 
 + <code c>
 +#include <graphics.h>
 +void linerel(int dx, int dy);
 +  </code>
 +
 +
 +==== Description of linerel ==== 
 +<code c>
 +linerel draws a line from the CP (current position) to a point that is a
 +relative distance (dx,dy) from the CP. The CP is advanced by (dx,dy).
 +</code>
 +
 +
 +==== Example of linerel ====
 +<code c>
 +/* linerel example */
 +
 +#include <graphics.h>
 +#include <stdlib.h>
 +#include <stdio.h>
 +#include <conio.h>
 +
 +int main(void)
 +{
 +   /* request autodetection */
 +   int gdriver = DETECT, gmode, errorcode;
 +   char msg[80];
 +
 +   /* initialize graphics and local variables */
 +   initgraph(&gdriver, &gmode, "");
 +
 +   /* read result of initialization */
 +   errorcode = graphresult();
 +   if (errorcode != grOk) {
 +printf("Graphics error: %s\n", grapherrormsg(errorcode));
 +printf("Press any key to halt:");
 +
 +getch();
 +exit(1);
 +   }
 +
 +   /* move the CP to location (20,30) */
 +   moveto(20,30);
 +
 +   /* create and output a message at (20,30) */
 +   sprintf(msg, " (%d, %d)", getx(), gety());
 +   outtextxy(20,30, msg);
 +
 +   /* draw line to a point a relative distance away from current CP */
 +   linerel(100, 100);
 +
 +   /* create and output a message at CP */
 +   sprintf(msg, " (%d, %d)", getx(), gety());
 +   outtext(msg);
 +
 +   /* clean up */
 +   getch();
 +   closegraph();
 +
 +   return 0;
 +}
 +</code>
 +
 +
 +==== See also ====
 +[[getlinesettings]]
 +[[line]]
 +[[lineto]]
 +[[setcolor]]
 +[[setlinestyle]]
 +[[setwritemode]]
 +
 +
 +===== output of linerel example ===== 
 +
 +    no output of example at the moment
 +    do not hesitate and add it...  
 +
 +
  
advertising
c/graphics.h/linerel.txt · Last modified: 2015/05/06 23:06 (external edit)

Impressum Datenschutz