home *** CD-ROM | disk | FTP | other *** search
/ Mega CD-ROM 1 / megacd_rom_1.zip / megacd_rom_1 / SCREEN / HERCULES.ZIP / TESTPIX.C < prev    next >
C/C++ Source or Header  |  1986-09-04  |  2KB  |  92 lines

  1.  
  2. /*  MAIN tests PIXEL by drawing lines on the screen  */
  3.  
  4. #include    "stdio.h"
  5.  
  6. main ()
  7. {
  8.     int i,j;
  9.     char    line [90];
  10.  
  11.     /* first clear screen */
  12.     grafix (0);
  13.  
  14.     /* now draw a couple of lines */
  15.     for (i=0; i<696; i++)
  16.     {
  17.         pixel (i, i/2, 1);
  18.         pixel (i, 348 - i/2, 1);
  19.     }
  20.  
  21.     waitkey();        /* wait for CR */
  22.  
  23.     /* a different pattern on page 1 */
  24.     swpage (1);
  25.     for (i=0; i<720; i++)
  26.     for (j=0; j<348; j=j+50)
  27.         pixel (i,j,1);
  28.     for (i=0; i<720; i=i+90)
  29.     for (j=0; j<348; j++)
  30.         pixel (i,j,1);
  31.  
  32.     /* switch back and forth a couple of times */
  33.     waitkey();
  34.     swpage (0);
  35.     waitkey();
  36.     swpage (1);
  37.     waitkey();
  38.     swpage (0);
  39.     waitkey();
  40.     swpage (1);
  41.     waitkey();
  42.  
  43. #ifndef NOTONE
  44.     /* add some writing */
  45.     dline (10, 4, "Hello, there!");
  46.     dline (10, 5, "Second LINE of text.");
  47.     dline (10, 6, "all on display page 1.");
  48.  
  49.     waitkey();
  50.     for (i=0; i<8; i++)
  51.         for (j=0; j<32; j++)
  52.             dchar (j+5, i+13, (char) (32*i+j));
  53.  
  54.     waitkey();
  55. #endif
  56.     /* repeat for page 0 */
  57.     swpage (0);
  58.  
  59. #ifndef NOTZERO
  60.     /* add some writing */
  61.     dline (10, 4, "Hello, there!");
  62.     dline (10, 5, "Second LINE of text.");
  63.     dline (10, 6, "this time on display page 0.");
  64.  
  65.     waitkey();
  66.     for (i=0; i<8; i++)
  67.         for (j=0; j<32; j++)
  68.             dchar (j+5, i+13, (char) (32*i+j));
  69. #endif
  70.  
  71.     waitkey();
  72.  
  73.     /* back to alpha mode */
  74.     waitkey();
  75.     alfa();
  76. }
  77.  
  78. dline (x, y, chstr)    /* write character-string at x,y */
  79.     int     x,y;
  80.     char    chstr [90];
  81. {
  82.     int    i;
  83.     char    *p;
  84.  
  85.     i=0;
  86.     for ( p=chstr; *p != '\0'; p++ )
  87.     {
  88.         dchar ( x+i, y, *p );
  89.         i++;
  90.     }
  91. }
  92.