home *** CD-ROM | disk | FTP | other *** search
- /*
- ** Fade Demo (OCS/ECS)
- ** -------------------
- ** There are three examples of fading in this program: Palette to Colour,
- ** Colour to Palette, Colour Morph.
- **
- ** ColourToPalette() is called as soon as you run the executable, then you
- ** have to press the Left Mouse Button to see the rest of the fade sequence.
- **
- */
-
- #include <proto/games.h>
- #include <proto/exec.h>
-
- struct GMSBase *GMSBase;
- extern struct ExecBase *SysBase;
-
- #define AMT_PLANES 5
-
- UWORD Palette[] = {
- 0x0000,0x0130,0x0FCB,0x0FA9,0x0D88,0x0965,0x0644,0x0211,
- 0x0400,0x0444,0x0FF0,0x0432,0x0CC0,0x0150,0x0501,0x0880,
- 0x0261,0x0271,0x0382,0x0492,0x05A3,0x05B4,0x0677,0x06C4,
- 0x0788,0x09AA,0x0BCC,0x0801,0x0901,0x0A02,0x0701,0x0601
- };
-
- struct GameScreen GameScreen = {
- GSV1, /* Structure version */
- 0,0,0, /* Screen_Mem1,2,3 */
- 0, /* ScreenLink */
- 0, /* Adress of palette */
- 0, /* Address of rasterlist */
- 0, /* Amount of colours */
- 320,256, /* Screen Width and Height */
- 0,0,0, /* Picture Width/8 and Height */
- AMT_PLANES, /* Amount of bitplanes */
- 0,0, /* X/Y screen offset */
- 0,0, /* X/Y picture offset */
- 0, /* Special attributes */
- LORES|COL12BIT, /* Screen mode */
- ILBM, /* Screen type */
- };
-
- struct Picture Picture = {
- PCV1, /* Version header */
- 0, /* Destination */
- 320,0,256, /* Width, Height */
- AMT_PLANES, /* Amount of Planes */
- 32, /* Amount of colours */
- &Palette, /* Palette */
- LORES|COL12BIT, /* Screen mode */
- INTERLEAVED, /* Destination */
- 0, /* Parameters */
- "GAMESLIB:data/IFF.Pic320"
- };
-
- struct GameScreen *OurScreen = &GameScreen;
- struct Picture *LoadingPic = &Picture;
-
- /*=========================================================================*/
-
- void main(void)
- {
- UWORD FState = 0;
-
- GMSBase = (struct GMSBase *) OpenLibrary("games.library", 0);
-
- SetUserPrefs(0);
-
- if (AddScreen(OurScreen) == NULL) {
-
- LoadingPic->Data = OurScreen->MemPtr1;
- if (LoadPic(LoadingPic) == NULL) {
- ShowScreen(OurScreen);
-
- do { WaitVBL();
- WaitSVBL();
- FState = ColourToPalette(OurScreen,FState,1,0,32,&Palette,0x000);
- }
- while (FState != NULL);
-
- WaitLMB();
-
- do { WaitSVBL();
- WaitVBL();
- FState = PaletteToColour(OurScreen,FState,1,0,32,&Palette,0xFFF);
- }
- while (FState != NULL);
-
- WaitTime(30);
-
- do { WaitSVBL();
- WaitVBL();
- FState = ColourMorph(OurScreen,FState,1,0,32,0xFFF,0x000);
- }
- while (FState != NULL);
-
- WaitTime(30);
- }
- DeleteScreen(OurScreen);
- }
- CloseLibrary((struct Library *)GMSBase);
- }
-
-