home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / dev / misc / gms_dev.lha / GMS / Source / C / AGAWhiteFade.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-02-16  |  2.6 KB  |  83 lines

  1. /*
  2. ** AGA WhiteFade Demo
  3. ** ------------------
  4. ** There are three examples of fading in this program:  ColourMorph(),
  5. ** ColourToPalette(), and PaletteToColour().
  6. **
  7. */
  8.  
  9. #include <proto/games.h>
  10. #include <proto/exec.h>
  11.  
  12. struct GMSBase *GMSBase;
  13. extern struct ExecBase *SysBase;
  14.  
  15. #define AMT_PLANES 5
  16.  
  17. struct GameScreen GameScreen = {
  18.        GSV1,                /* Structure version */
  19.        0,0,0,               /* Screen memory 1,2,3 */
  20.        0,                   /* Screen link */
  21.        0,                   /* Adress of palette */
  22.        0,                   /* Address of rasterlist */
  23.        32,                  /* Amount of colours */
  24.        320,256,             /* Screen Width and Height */
  25.        0,0,0,               /* Picture Widths and Height */
  26.        AMT_PLANES,          /* Amount of bitplanes */
  27.        0,0,                 /* X/Y screen offset */
  28.        0,0,                 /* X/Y picture offset */
  29.        0,                   /* Special attributes */
  30.        LORES|COL24BIT,      /* Screen mode */
  31.        INTERLEAVED,         /* Screen type */
  32.        };
  33.  
  34. struct Picture Picture = {
  35.        PCV1,                /* Version header */
  36.        0,                   /* Destination */
  37.        320,320/8,256,       /* Width, Height */
  38.        AMT_PLANES,          /* Amount of Planes */
  39.        32,                  /* Amount of colours */
  40.        0,                   /* Palette (remap) */
  41.        LORES|COL24BIT,      /* Screen mode */
  42.        INTERLEAVED,         /* Destination */
  43.        GETPALETTE,          /* Parameters */
  44.        "GAMESLIB:data/IFF.Loading"
  45.        };
  46.  
  47. struct GameScreen *OurScreen = &GameScreen;
  48. struct Picture *LoadingPic = &Picture;
  49.  
  50. /*=========================================================================*/
  51.  
  52. void main(void)
  53. {
  54.    UWORD FadeState = 0;
  55.  
  56.    if (GMSBase = (struct GMSBase *) OpenLibrary("games.library", 0)) {
  57.       SetUserPrefs(0);
  58.       if (AddScreen(OurScreen) == NULL) {
  59.          LoadingPic->Data = OurScreen->MemPtr1;
  60.          if (LoadPic(LoadingPic) == NULL) {
  61.             ShowScreen(OurScreen);
  62.  
  63.             do { WaitSVBL();
  64.                  FadeState = ColourMorph(OurScreen,FadeState,10,0,32,0x000000,0xFFFFFF);
  65.             } while (FadeState != NULL);
  66.  
  67.             do { WaitSVBL();
  68.                  FadeState = ColourToPalette(OurScreen,FadeState,2,0,32,LoadingPic->Palette,0xFFFFFF);
  69.             } while (FadeState != NULL);
  70.  
  71.             do { WaitSVBL();
  72.                  FadeState = PaletteToColour(OurScreen,FadeState,2,0,32,LoadingPic->Palette,0x000000);
  73.             } while (FadeState != NULL);
  74.  
  75.             FreePic(LoadingPic);
  76.          }
  77.       DeleteScreen(OurScreen);
  78.       }
  79.    CloseLibrary((struct Library *)GMSBase);
  80.    }
  81. }
  82.  
  83.