home *** CD-ROM | disk | FTP | other *** search
/ Amiga ACS 1998 #6 / amigaacscoverdisc1998-061998.iso / games / descent / source / 2d / vesatest.c < prev    next >
Text File  |  1998-06-08  |  4KB  |  148 lines

  1. /*
  2. THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
  3. SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
  4. END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
  5. ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
  6. IN USING, DISPLAYING,  AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
  7. SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
  8. FREE PURPOSES.  IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
  9. CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES.  THE END-USER UNDERSTANDS
  10. AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.  
  11. COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
  12. */
  13. /*
  14.  * $Source: f:/miner/source/2d/rcs/vesatest.c $
  15.  * $Revision: 1.3 $
  16.  * $Author: john $
  17.  * $Date: 1993/12/21 11:40:47 $
  18.  * 
  19.  * .
  20.  * 
  21.  * $Log: vesatest.c $
  22.  * Revision 1.3  1993/12/21  11:40:47  john
  23.  * *** empty log message ***
  24.  * 
  25.  * Revision 1.2  1993/12/09  17:14:14  john
  26.  * VESA test program.
  27.  * 
  28.  * Revision 1.1  1993/12/09  16:53:01  john
  29.  * Initial revision
  30.  * 
  31.  * 
  32.  */
  33.  
  34.  
  35. #pragma off (unreferenced)
  36. static char rcsid[] = "$Id: vesatest.c 1.3 1993/12/21 11:40:47 john Exp $";
  37. #pragma on (unreferenced)
  38.  
  39. #include <stdlib.h>
  40. #include <stdio.h>
  41. #include <conio.h>
  42. #include <malloc.h>
  43.  
  44. #include "gr.h"
  45.  
  46. char palette[256*3];
  47. extern void gr_pal_setblock( int start, int number, unsigned char * pal );
  48.  
  49. void CreatePalette( )
  50. {
  51.     int i;
  52.  
  53.     for (i=0; i<64; i++ )
  54.     {
  55.         // Make 0-63 be red shades
  56.         palette[ i*3+0 ] = i;    // Red
  57.         palette[ i*3+1 ] = 0;    // Green        
  58.         palette[ i*3+2 ] = 0;    // Blue
  59.  
  60.         // Make 64-127 be green shades
  61.         palette[ i*3+0+64*3 ] = 0;    // Red
  62.         palette[ i*3+1+64*3 ] = i;    // Green        
  63.         palette[ i*3+2+64*3 ] = 0;    // Blue
  64.  
  65.         // Make 128-191 be blue shades
  66.         palette[ i*3+0+128*3 ] = 0;    // Red
  67.         palette[ i*3+1+128*3 ] = 0;    // Green        
  68.         palette[ i*3+2+128*3 ] = i;    // Blue
  69.         
  70.         // Make 192-255 be greyscale
  71.         palette[ i*3+0+192*3 ] = i;    // Red
  72.         palette[ i*3+1+192*3 ] = i;    // Green        
  73.         palette[ i*3+2+192*3 ] = i;    // Blue
  74.     }
  75. }
  76.  
  77. main()
  78. {
  79.     int i;
  80.  
  81.     printf( "This program tests VESA mode 103 (800x600x256).\n" );
  82.     printf( "You should see a dark blue screen with a red border,\n" );
  83.     printf( "When you hit return once, there should be three\n" );
  84.     printf( "horizontal color bands, each one going through\n" );
  85.     printf( "shades of red,green,blue, and white, respectively,\n" );
  86.     printf( "and all this surrounded by a white frame.\n" );
  87.     printf( "Press any key...\n" );
  88.  
  89.     getch();
  90.  
  91.     CreatePalette();
  92.  
  93.     i = gr_init( SM_800x600V );
  94.  
  95.     if (i)    {
  96.         printf( "Couldn't initialize because " );
  97.         
  98.         switch(i)
  99.         {
  100.             case 1:    printf( "no VGA adapter is installed.\n" ); break;
  101.             case 2:  printf( "Inferno doesn't support this cards granularity.\n" ); break;
  102.             case 3:    printf( "your monitor doesn't support 800x600.\n" ); break;
  103.             case 4:    printf( "your video card doesn't support that VESA mode.\n" ); break;
  104.             case 5:    printf( "no VESA driver was detected.\n" ); break;
  105.             case 6:    printf( "a VESA call returned a bad status code.\n" ); break;
  106.             case 7:    printf( "there isn't enough low memory.\n" ); break;
  107.             case 8:    printf( "a DPMI call failed.\n" ); break;
  108.             case 9:  printf( "your card couldn't set the correct logical line width.\n" ); break;
  109.             default: printf( "of unknown error %d\n" ); break;
  110.             exit(1);
  111.         }
  112.     }
  113.     
  114.     gr_setcolor( 1 );
  115.     gr_urect( 0, 0, 799, 599 );
  116.     gr_setcolor( 12 );
  117.     gr_ubox(0,0,799, 599);
  118.  
  119.     getch();
  120.  
  121.     gr_pal_setblock( 0, 256, palette );
  122.  
  123.     gr_setcolor( 0 );
  124.     gr_urect( 0, 0, grd_curcanv->cv_bitmap.bm_w-1, grd_curcanv->cv_bitmap.bm_h-1 );
  125.  
  126.     for (i=0; i< 256; i++ )
  127.     {
  128.             gr_setcolor( i );
  129.             gr_urect( 0, i*2, 799, i*2+1 );
  130.     }
  131.     gr_setcolor( 255 ); gr_ubox(0,0,799, 599);
  132.     gr_setcolor( 245 ); gr_ubox(1,1,798, 598);
  133.     gr_setcolor( 235 ); gr_ubox(2,2,797, 597);
  134.     gr_setcolor( 225 ); gr_ubox(3,3,796, 596);
  135.     gr_setcolor( 215 ); gr_ubox(4,4,795, 595);
  136.     gr_setcolor( 205 ); gr_ubox(5,5,794, 594);
  137.  
  138.     getch();
  139.  
  140. }
  141.     
  142.  
  143.  
  144.  
  145.  
  146.  
  147. 
  148.