home *** CD-ROM | disk | FTP | other *** search
/ Graphics Programming Black Book (Special Edition) / BlackBook.bin / disk1 / source / chapterb / lb-2.c < prev    next >
C/C++ Source or Header  |  1997-06-18  |  802b  |  32 lines

  1. /* *** Listing 17.2 ***
  2.  *
  3.  * Draws a series of concentric circles.
  4.  * For VGA only, because mode 12h is unique to VGA.
  5.  * Compile and link with L17-X (1 or 3) using Borland C++ 4.02:
  6.  *   bcc -ms l17-X.c l17-2.c
  7.  * Checked by Jim Mischel  11/30/94
  8.  */
  9.  
  10. #include <dos.h>
  11.  
  12. main() {
  13.    int Radius, Temp, Color;
  14.    union REGS Regs;
  15.  
  16. /* Select VGA's hi-res 640x480 graphics mode, mode 12h */
  17.    Regs.x.ax = 0x0012;
  18.    int86(0x10, &Regs, &Regs);
  19.  
  20. /* Draw concentric circles */
  21.    for ( Radius = 10, Color = 7; Radius < 240; Radius += 2 ) {
  22.     DrawCircle(640/2, 480/2, Radius, Color);
  23.     Color = (Color + 1) & 0x0F;    /* cycle through 16 colors */
  24.    }
  25.  
  26. /* Wait for a key, restore text mode, and done */
  27.    scanf("%c", &Temp);
  28.    Regs.x.ax = 0x0003;
  29.    int86(0x10, &Regs, &Regs);
  30. }
  31.  
  32.