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

  1.                                                       // Example: 129 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. short  main(void)
  9. {
  10.   dddLoadColors("EXAMPLE.COL");                       // Load in the color palette called 'example.col' to 'standardpal'.
  11.   dddInitVideo();
  12.   dddSetPal(dddstandardpal);
  13.   dddInit3d();
  14.   for  (count=0; count<0xFF00; count+=0x40)           // Loop a few times.
  15.   {
  16.     dddSet2dRotation(count);                          // Set up the rotation value.
  17.     Store=RotatedPoly+2;                              // Store points at the output area.
  18.     dddRotateXY(Store, PolyCoords[0], PolyCoords[1]); // Rotate top left of the box and store result.
  19.     Store=RotatedPoly+4;
  20.     dddRotateXY(Store, PolyCoords[2], PolyCoords[3]); // Rotate top right of the box and store result.
  21.     Store=RotatedPoly+6;
  22.     dddRotateXY(Store, PolyCoords[4], PolyCoords[5]); // Rotate bot right of the box and store result.
  23.     Store=RotatedPoly+8;
  24.     dddRotateXY(Store, PolyCoords[6], PolyCoords[7]); // Rotate bot left of the box and store result.
  25.     Store=RotatedPoly+2;                              // Now we will add on offset to each point.
  26.     for  (i=0; i<8; i++)
  27.     {
  28.       Store[i]=Store[i]+100;                          // Add 100 to each calculated and rotated coordinate.
  29.     }
  30.     dddCls();                                         // Clear the logbase screen.
  31.     dddDrawPoly(RotatedPoly);                         // Draw the rotated points.
  32.     dddScreenSwap();                                  // Swap the dummy and real screens.
  33.   }
  34.   dddRestoreVideo();
  35.   dddClose3d();
  36.   return 0;
  37. }
  38.