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

  1.                                    // Example: 167 from Library Reference
  2. #include "..\3D-Ware\dddware.h"
  3. #include <conio.h>
  4. #include <dos.h>
  5.  
  6. #ifdef __WATCOMC__                   // If using Watcom C
  7. #define outportb outp                // Then make sure the name is correct.
  8. #endif                               // Finished with Watcom C specific code.
  9.  
  10. char  red, green, blue;
  11. short  main(void)
  12. {
  13.   dddInitAll();
  14.   while  (!dddkeycode)             // Run until a key is pressed.
  15.   {
  16.     for  (red=0; red<64; red++)    // Loop, whilst incrementing the red value.
  17.     {
  18.       dddVsync();                  // Wait for a Vertical Sync pulse.
  19.       delay(2);                    // Delay for 2 milliseconds.
  20.       outportb(0x3C8,0);           // Select color 0 via hardware port.
  21.       outportb(0x3C9,red);         // Write the red potion of color 0.
  22.       outportb(0x3C9,green);       // Write the green portion of color 0.
  23.       outportb(0x3C9,blue);        // Write the blue portion of color 0.
  24.       delay(3);                    // Wait 3 milliseconds.
  25.       outportb(0x3C8,0);           // Select color 0 via hardware port.
  26.       outportb(0x3C9,0);           // Red portion is 0.
  27.       outportb(0x3C9,0);           // Green portion is 0.
  28.       outportb(0x3C9,0);           // Blue portion is 0.
  29.     }
  30.   }
  31.   dddRestoreAll();                 // Clean up.
  32.   return (0);                      // Bye.
  33. }
  34.