home *** CD-ROM | disk | FTP | other *** search
/ Black Art of 3D Game Programming / Black_Art_of_3D_Game_Programming.iso / source / msc / chap_3 / modez.c < prev    next >
Text File  |  1994-10-05  |  1KB  |  54 lines

  1.  
  2. // MODEZ.C - A demo of mode Z (320x400x256)
  3.  
  4. // I N C L U D E S ///////////////////////////////////////////////////////////
  5.  
  6. #include <io.h>
  7. #include <conio.h>
  8. #include <stdio.h>
  9. #include <stdlib.h>
  10. #include <dos.h>
  11. #include <bios.h>
  12. #include <fcntl.h>
  13. #include <memory.h>
  14. #include <malloc.h>
  15. #include <math.h>
  16. #include <string.h>
  17.  
  18. #include "black3.h"
  19.  
  20. // M A I N ////////////////////////////////////////////////////////////////////
  21.  
  22. void main(int argc, char **argv)
  23. {
  24. int index, // loop variables
  25.     x,y,
  26.     color; // holds the current color
  27.  
  28. // set the graphics mode to mode Z 320x400x256
  29.  
  30. Set_Mode_Z();
  31.  
  32. // fill the screen with dark grey
  33.  
  34. Fill_Screen_Z(8);
  35.  
  36. // plot 1000 pixels in each of the colors
  37.  
  38. for (color=1; color<256; color++)
  39.     for (index=0; index<1000; index++)
  40.         Write_Pixel_Z(rand()%320,rand()%400,color);
  41.  
  42. // wipe screen
  43.  
  44. for (index=320; index>=0; index--)
  45.     for (y=0; y<400; y++)
  46.         Write_Pixel_Z(index,y,0);
  47.  
  48. // restore the video system to text
  49.  
  50. Set_Graphics_Mode(TEXT_MODE);
  51.  
  52. } // end main
  53.  
  54.