home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / c / other / graphics / color.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-10-07  |  728 b   |  32 lines

  1.  /* COLOR.C: Sets a medium resolution mode with maximum color choices */ 
  2.  
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <graph.h>
  6. #include <conio.h>
  7. struct videoconfig vc;
  8.  
  9. main()
  10. {
  11.    if( _setvideomode( _MRES256COLOR ) )
  12.       ;
  13.    else if( _setvideomode( _MRES16COLOR ) )
  14.       ;
  15.    else if( _setvideomode( _MRES4COLOR ) )
  16.       ;
  17.    else   {
  18.       printf( "Error: No color graphics capability\n" );
  19.       exit( 0 );
  20.    }
  21.  
  22.    _getvideoconfig( &vc );
  23.  
  24.    printf( "%d available colors\n", vc.numcolors );
  25.    printf( "%d horizontal pixels\n", vc.numxpixels );
  26.    printf( "%d vertical pixels\n", vc.numypixels );
  27.  
  28.    getch();
  29.    _clearscreen( _GCLEARSCREEN );
  30.    _setvideomode( _DEFAULTMODE );
  31. }
  32.