I have a problem with Turbo C because I am trying make to following program
work with a Hercules graphics card :
/* filename : X-J29.C
   purpose  : having fun with Turbo C Graphics Library (screen saver)
   requires CGA/EGA/VGA*/

/* include header files */
#include <graphics.h>
#include <stdlib.h>
#include <conio.h>
#include <stdio.h>

main()
{
     {
     /* code to detect graphic adapter */

     int graphmode, graphdriver = DETECT;
     int color;
     int i, j, x, y;
     struct viewporttype vp;
     int height, width;
     int maxcolors;
     struct palettetype palette;

     if (registerbgidriver(Herc_driver) < 0) exit(1);
     if (registerbgidriver(EGAVGA_driver) < 0) exit(1);
     if (registerbgidriver(CGA_driver) < 0) exit(1);

     initgraph(&graphdriver, &graphmode, "");
     graphdefaults();

     maxcolors = getmaxcolor() + 1;

     getviewsettings( &vp );
     width  = (vp.right - vp.left) / 15;   /* get width of the box
*/
     height = (vp.bottom - vp.top) / 10;   /* Get the height of the box
*/
     x = y = 0;                            /* Start in upper corner
*/
     color = 1;                            /* Begin at 1st color
*/
     for( j=0 ; j<10 ; ++j ){              /* For 10 rows of boxes
*/
          for( i=0 ; i<15 ; ++i ){            /* For 15 columns of boxes
*/
          setfillstyle( SOLID_FILL, color++ );      /* Set the color of box
*/
          bar( x, y, x+width, y+height );           /* Draw the box
*/
          x += width + 1;                           /* Advance to next col
*/
          color = 1 + (color % (maxcolors - 2));    /* Set new color
*/
             }                           /* End of COLUMN loop           */
x = 0;                              /* Goto 1st column              */
y += height + 1;                    /* Goto next row                */
          }                                     /* End of ROW loop
*/
     while( !kbhit() ){                    /* Until user enters a key...
*/
         setpalette( 1+random(maxcolors - 2), random( 65 ) );
         }
     setallpalette( &palette );

     getche();
     closegraph();
     return;

     }
} /* End of program */

If you have any suggestions, email me at [EMAIL PROTECTED]

To unsubscribe from SURVPC send a message to [EMAIL PROTECTED] with 
unsubscribe SURVPC in the body of the message.
Also, trim this footer from any quoted replies.

Reply via email to