home *** CD-ROM | disk | FTP | other *** search
/ Virtual Reality Madness / VRMAD96_ONE.ISO / virtek / libex / libex121.c < prev    next >
C/C++ Source or Header  |  1995-08-24  |  2KB  |  33 lines

  1.                                                       // Example: 121 from Library Reference
  2. #include "..\3D-Ware\dddware.h"
  3. unsigned short  count, i;
  4.                                                       // A square box around a point at 0x,0y.
  5. short  PolyCoords[]={-25,-25, 25,-25, 25,25, -25,25};
  6. short  RotatedPoly[]={2,4, 0,0, 0,0, 0,0, 0,0};       // A DrawPoly structure.
  7. short  *Store;
  8. void   main(void)
  9. {
  10.   dddInitAll();
  11.   for  (count=0; count<0xFF00; count+=0x40)           // Loop a few times.
  12.   {
  13.     dddSet2dRotation(count);                          // Set up the rotation value.
  14.     Store=RotatedPoly+2;                              // Store points at the output area.
  15.     dddRotateXY(Store, PolyCoords[0], PolyCoords[1]); // Rotate top left of the box and store result.
  16.     Store=RotatedPoly+4;
  17.     dddRotateXY(Store, PolyCoords[2], PolyCoords[3]); // Rotate top right of the box and store result.
  18.     Store=RotatedPoly+6;
  19.     dddRotateXY(Store, PolyCoords[4], PolyCoords[5]); // Rotate bot right of the box and store result.
  20.     Store=RotatedPoly+8;
  21.     dddRotateXY(Store, PolyCoords[6], PolyCoords[7]); // Rotate bot left of the box and store result.
  22.     Store=RotatedPoly+2;                              // Now we will add on offset to each point.
  23.     for  (i=0; i<8; i++)
  24.     {
  25.       Store[i]=Store[i]+100;                          // Add 100 to each calculated and rotated coordinate.
  26.     }
  27.     dddCls();                                         // Clear the logbase screen.
  28.     dddDrawPoly(RotatedPoly);                         // Draw the rotated points.
  29.     dddScreenSwap();                                  // Swap the dummy and real screens.
  30.   }
  31.   dddRestoreAll();
  32. }
  33.