home *** CD-ROM | disk | FTP | other *** search
- /*
- ** Mirror Demo
- ** -----------
- ** Demo of the mirroring effect. When this effect is combined with a
- ** decrease in palette values at the same line, you can create the illusion of
- ** water.
- **
- ** Use the mouse to move the mirror around. LMB exits.
- */
-
- #include <proto/exec.h>
- #include <proto/games.h>
-
- struct GMSBase *GMSBase;
- extern struct ExecBase *SysBase;
-
- #define AMT_PLANES 5
-
- UWORD Palette[] =
- {
- 0x000,0x130,0xFCB,0xFA9,0xD88,0x965,0x644,0x211,
- 0x400,0x444,0xFF0,0x432,0xCC0,0x150,0x501,0x880,
- 0x261,0x271,0x382,0x492,0x5A3,0x5B4,0x677,0x6C4,
- 0x788,0x9AA,0xBCC,0x801,0x901,0xA02,0x701,0x601
- };
-
- UWORD WaterPalette[] =
- {
- 0x000,0x010,0x765,0x754,0x644,0x432,0x322,0x100,
- 0x200,0x222,0x770,0x211,0x660,0x020,0x200,0x440,
- 0x130,0x130,0x141,0x241,0x251,0x252,0x333,0x362,
- 0x344,0x455,0x666,0x400,0x400,0x501,0x300,0x300
- };
-
- ULONG RasterList[] =
- {
- WAITLINE(190),
- MIRROR,
- NEWPALETTE(0,32,WaterPalette),
- RASTEND
- };
-
- struct GameScreen GameScreen =
- {
- GSV1, /* Structure version */
- 0,0,0, /* Screen Memory 1,2,3 */
- 0, /* Screen Link */
- Palette, /* Adress of palette */
- RasterList, /* Address of rasterlist */
- 0, /* Amount of colours */
- 320,256, /* Screeen Width, Height */
- 336,0,256, /* Picture Width, ByteWidth, Height */
- AMT_PLANES, /* Amount of bitplanes */
- 0,0, /* X/Y screen offset */
- 0,0, /* X/Y picture offset */
- HSCROLL|VSCROLL, /* Special attributes */
- LORES|COL12BIT, /* Screen mode */
- 0, /* Screen type */
- };
-
- struct Picture MirrorPic =
- {
- PCV1, /* Version header */
- 0, /* Destination */
- 336,0,256, /* Width, Height */
- AMT_PLANES, /* Amount of planes */
- 32, /* Amount of colours */
- Palette, /* Palette */
- LORES|COL12BIT, /* Screen mode */
- 0, /* Screen type */
- 0, /* Parameters */
- "GAMESLIB:data/IFF.Pic336"
- };
-
- /*=========================================================================*/
-
- void main(void)
- {
- ULONG mouse;
-
- if (GMSBase = (struct GMSBase *) OpenLibrary("games.library", 0)) {
- SetUserPrefs(0);
- if (AddScreen(&GameScreen) == NULL)
- {
- MirrorPic.Data = GameScreen.MemPtr1;
- MirrorPic.ScrType = GameScreen.ScrType;
- LoadPic(&MirrorPic);
-
- ShowScreen(&GameScreen);
- InitJoyPorts();
-
- do
- {
- mouse = ReadJoyPort(JPORT1,JT_ZBXY);
- GameScreen.PicXOffset += (BYTE)(mouse >> 8);
- GameScreen.PicYOffset += (BYTE)(mouse);
- if (GameScreen.PicXOffset < 0) GameScreen.PicXOffset = 0;
- if (GameScreen.PicXOffset > 16) GameScreen.PicXOffset = 16;
- if (GameScreen.PicYOffset < 0) GameScreen.PicYOffset = 0;
- if (GameScreen.PicYOffset > 255-190) GameScreen.PicYOffset = 255-190;
- MovePicture(&GameScreen);
- WaitSVBL();
- } while (!(mouse & MB_LMB));
-
- DeleteScreen(&GameScreen);
- }
- CloseLibrary((struct Library *)GMSBase);
- }
- }
-
- /*=========================================================================*/
-