#include "exec/types.h"
#include "intuition/intuition.h"

struct IntuitionBase *IntuitionBase;
struct GfxBase *GfxBase;

struct Screen *Scrn;
struct Window *NoBorder;
struct RastPort *rp;
struct ViewPort *vp;


#define MODBLU 0x10
#define MODRED 0x20
#define MODGRN 0x30

struct NewScreen NewScrn =
{
 0,0,
 320,200,6,
 1,0,
 HAM,
 CUSTOMSCREEN,
 NULL,                    /* Pointer to custom font */
 NULL,                    /* Pointer to title text */
 NULL,                    /* Pointer to screen gadgets */
 NULL                     /* Pointer to custom bitmap */
};

struct NewWindow NewNoBorder =
{
 0,0,
 320,200,
 0,0,
 CLOSEWINDOW,             /*  IDCMP flags */
 SMART_REFRESH | ACTIVATE | BORDERLESS | WINDOWCLOSE, /* flags */
 NULL,                    /* Pointer to first gadget */
 NULL,                    /* Pointer to Check Mark image */
 NULL,                    /* Title */
 NULL,                    /* Pointer to Screen structure */
 NULL,                    /* Pointer to custom bitmap */
 0,0,                     /* Min Width, Min Height */
 0,0,                     /* Max Width, Max Height */     
 CUSTOMSCREEN             /* Type of Screen this window resides on */
};

main()
{

OpenALL();

if((NewNoBorder.Screen = Scrn = (struct Screen *)OpenScreen(&NewScrn)) == NULL)
 CloseALL();

if((NoBorder = (struct Window *)OpenWindow(&NewNoBorder)) == NULL)
 CloseALL();

vp = (struct ViewPort *) ViewPortAddress(NoBorder);
rp = NoBorder->RPort;

SetRGB4(vp,0,0,0,0);
SetRGB4(vp,1,15,0,0);
SetRGB4(vp,2,0,0,15);
SetRGB4(vp,3,0,15,0);

drawham();

Wait(1 << NoBorder->UserPort->mp_SigBit);

CloseALL();
}

OpenALL()
{
 if((IntuitionBase = (struct IntuitionBase *)
     OpenLibrary("intuition.library",0)) == NULL) CloseALL();

 if((GfxBase = (struct GfxBase *)
     OpenLibrary("graphics.library",0)) == NULL) CloseALL();
}

CloseALL()
{
 if(NoBorder) CloseWindow(NoBorder);
 if(Scrn) CloseScreen(Scrn);
 if(GfxBase) CloseLibrary(GfxBase);
 if(IntuitionBase) CloseLibrary(IntuitionBase);
 exit(1);
}

drawham()
{
 int c;

 for(c=0;c<32;c++)
 {
  SetAPen(rp,MODRED+c);
  RectFill(rp,10*c,0,10*c+19,20-1);        
  RectFill(rp,10*c,100,10*c+19,120-1);

  SetAPen(rp,MODBLU+c);
  RectFill(rp,10*c,20,10*c+19,40-1);        
  RectFill(rp,10*c,120,10*c+19,140-1);

  SetAPen(rp,MODRED+c);
  RectFill(rp,10*c,40,10*c+19,60-1);        
  RectFill(rp,10*c,140,10*c+19,160-1);

  SetAPen(rp,MODBLU+c);
  RectFill(rp,10*c,60,10*c+19,80-1);        
  RectFill(rp,10*c,160,10*c+19,180-1);

  SetAPen(rp,MODRED+c);
  RectFill(rp,10*c,80,10*c+19,100-1);        
  RectFill(rp,10*c,180,10*c+19,200-1);
 }

 Delay(200);

 for(c=1;c<100;c++)
 {
  Delay(10);
  SetAPen(rp,c);
  Move(rp,0,0);Draw(rp,0,199);
 }


} /* end of Ham() */





        
