/*
** HiRes Picture Display
** ---------------------
** Opens a screen of 640 pixels width in HIRES mode.  You can even try
** SuperHiRes (SHIRES) if you change the appropriate flag in the GameScreen
** structure.
*/

#include <proto/exec.h>
#include <proto/games.h>
#include <exec/memory.h>

struct GMSBase *GMSBase;
extern struct ExecBase *SysBase;

#define AMT_PLANES 4

UWORD Palette[] =
{
     0x0000,0x0400,0x0501,0x0501,0x0601,0x0701,0x0701,0x0801,
     0x0901,0x0A01,0x0B02,0x0432,0x0CC0,0x0F00,0x0211,0x0880
};

struct GameScreen GameScreen =
{
     GSV1,           /* Structure version */
     0,0,0,          /* Screen_Mem1,2,3 */
     0,              /* ScreenLink */
     Palette,        /* Adress of palette */
     0,              /* Address of rasterlist */
     16,             /* Amount of colours */
     640,256,        /* Screen Width and Height */
     640/8,256,      /* 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 */
     HIRES|COL12BIT, /* Screen mode */
     INTERLEAVED,    /* Screen type */
     0               /* Reserved */
};

struct Picture HiResPic =
{
     PCV1,           /* Version header */
     0,              /* Destination */
     640/8,256,      /* Width, Height */
     AMT_PLANES,     /* Amount of Planes */
     16,             /* Amount of colours */
     Palette,        /* Palette (remap) */
     HIRES|COL12BIT, /* Screen mode */
     INTERLEAVED,    /* Destination */
     0,              /* Parameters */
     "GAMESLIB:data/IFF.Pic640x256"
};

/*=========================================================================*/

void main(void)
{
   if (GMSBase = (struct GMSBase *) OpenLibrary("games.library", 0)) {
      SetUserPrefs(0);
      if (Add_Screen(&GameScreen) == NULL) {
         HiResPic.Data = GameScreen.MemPtr1;
         if (LoadPic(&HiResPic) == NULL) {
            Show_Screen(&GameScreen);
            Wait_LMB();
         }
      Delete_Screen(&GameScreen);
      }
   CloseLibrary((struct Library *)GMSBase);
   }
}

