home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / dos / grafik / turtle / turtle.doc < prev    next >
Encoding:
Text File  |  1988-12-31  |  3.5 KB  |  94 lines

  1.  
  2.  
  3.                     Turtle Graphics Commands for Turbo C Programmer
  4.  
  5.                                    31 December 1988     
  6.         
  7.                                    Gerald K. Hobart
  8.  
  9.         For Turbo C programmers who would like to do some turtle 
  10.         graphics, the file TURTLE.C contains the following turtle 
  11.         graphics commands:
  12.  
  13.              void penup(void);
  14.              void pendown(void);
  15.              void forward(int dist);
  16.              void back(int dist);
  17.              void right(double angl);
  18.              void left(double angl);
  19.              void setheading(double deg);
  20.              double getheading(void);
  21.              int getpen(void);
  22.  
  23.         The file TURTLE.H contains the above function prototypes, and 
  24.         should be included in any module using these functions.
  25.  
  26.         ----------------------------------------------------------------
  27.         
  28.         penup();
  29.              This command puts the pen in the UP position.  While the pen 
  30.              is up, no drawing will take place.  The pen is initially set 
  31.              to the UP position. 
  32.  
  33.         pendown();
  34.              This command puts the pen in the DOWN position.  The pen 
  35.              must be DOWN for any drawing to be done by the forward() or 
  36.              back() commands. 
  37.  
  38.         getpen();
  39.              This function returns 1 if the pen is DOWN, 0 if the pen is 
  40.              UP. 
  41.  
  42.         setheading(deg);
  43.              This function sets the heading to 'deg' degrees, where:
  44.  
  45.                   0   degrees is towards the top of the screen
  46.                   90  degrees is towards the right side of the screen
  47.                   180 degrees is towards the bottom of the screen
  48.                   270 degrees is towards the left side of the screen
  49.              
  50.              The argument 'deg' may be negative, and may exceed 360 
  51.              degrees, however the heading will always be normalized to a 
  52.              number between 0 and 360 degrees.  The heading is initially 
  53.              set to 0 degrees. 
  54.              
  55.         getheading();
  56.              This function returns the current heading.  This value will 
  57.              always be normalized to a value between 0 and 360 degrees.  
  58.                    
  59.         forward(dist);
  60.              This command moves the pen forward a distance of 'dist' 
  61.              pixels.  Forward means 'in the direction defined by the  
  62.              heading'.  (See the setheading() command.)  If the pen is 
  63.              DOWN when this command is given, a line will be drawn.  If 
  64.              the pen is UP, the pen will be moved, but no line will be 
  65.              drawn. 
  66.  
  67.         back(dist);
  68.              This behaves the same as the forward command except the the 
  69.              pen is moved backwards instead of forwards. 
  70.  
  71.         right(angl);
  72.              This command changes the heading to the right by 'angl' 
  73.              degrees. 
  74.      
  75.         left(angl);
  76.              This command changes the heading to the left by 'angl' 
  77.              degrees. 
  78.  
  79.         ----------------------------------------------------------------
  80.         
  81.         It should be relatively easy to convert this code for use with 
  82.         compilers other than Turbo C, providing of course there is a 
  83.         graphics library available.
  84.  
  85.         I would be interested in hearing about any additions, 
  86.         modifications, corrections or bug reports.
  87.  
  88.         Jerry Hobart
  89.         9700 Morrow NE
  90.         Albuquerque, NM 87112
  91.         (505) 298-0502
  92.  
  93.  
  94.