graphics.hlp (Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
COLOR.C
                                             Up Contents Index Back
────────────────────────────────────────────────────────────────────────────
 
 /* COLOR.C: Sets a medium resolution mode with maximum color choices */
#include <stdio.h>
#include <stdlib.h>
#include <graph.h>
#include <conio.h>
struct videoconfig vc;
 
main()
{
   if( _setvideomode( _MRES256COLOR ) )
      ;
   else if( _setvideomode( _MRES16COLOR ) )
      ;
   else if( _setvideomode( _MRES4COLOR ) )
      ;
   else   {
      printf( "Error: No color graphics capability\n" );
      exit( 0 );
   }
 
   _getvideoconfig( &vc );
 
   printf( "%d available colors\n", vc.numcolors );
   printf( "%d horizontal pixels\n", vc.numxpixels );
   printf( "%d vertical pixels\n", vc.numypixels );
 
   getch();
   _clearscreen( _GCLEARSCREEN );
   _setvideomode( _DEFAULTMODE );
}