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.
EGA.C
                                             Up Contents Index Back
────────────────────────────────────────────────────────────────────────────
 
/* EGA.C: Demonstrates EGA palettes */
#include <stdio.h>
#include <conio.h>
#include <graph.h>
 
main()
{
   _setvideomode( _ERESCOLOR );
   _setcolor( 4 );
   _rectangle( _GFILLINTERIOR, 50, 50, 200, 200 );
 
   _settextposition( 1, 1 );
   printf( "Normal palette\n" );
   printf( "Press a key" );
   getch();
 
   _remappalette( 4, _BLUE );
 
   _settextposition( 1, 1 );
   printf( "Remapped palette\n" );
   printf( "Press a key" );
   getch();
 
   _remappalette( 4, _RED );
 
   _settextposition( 1, 1 );
   printf( "Restored palette\n" );
   printf( "Press a key to clear the screen" );
   getch();
 
   _clearscreen( _GCLEARSCREEN );
   _setvideomode( _DEFAULTMODE );
}