/* screen_intuition.c 25.3.1  */
/* From Amiga C for Beginners */
/* by Abacus                  */

#include <exec/types.h>
#include <intuition/intuition.h>

extern LONG OpenLibrary();
extern struct Screen *OpenScreen();
extern struct Window *OpenWindow();

struct IntuitionBase *IntuitionBase;

#define INTUITION_REV 0

struct NewScreen NewScreen =
{
   0,0,
   640, /* Width */
   200, /* Height; PAL version-change 200 to 256 */
   3,   /* 3 bitplanes = 8 colors */
   3,5, /* another color combination */
   HIRES,
   CUSTOMSCREEN,
   NULL,
   "To end the program, please click Close-Gadget!",
   NULL,
   NULL,
};

struct NewWindow NewWindow =
{
   40, 40,   /* X and Y Position */
   280, 120,  /* Width, Height */
   4, 6,     /* Colors (0 - 7) */
   CLOSEWINDOW,
   WINDOWCLOSE | SMART_REFRESH | ACTIVATE | WINDOWSIZING |
      SIZEBRIGHT | WINDOWDRAG | WINDOWDEPTH,
   NULL,
   NULL,
   "*** Hello ***",
   NULL,
   NULL,
   190, 20,
   640, 200, /* in PAL systems change the 200 to 256 */
   CUSTOMSCREEN
};


main()
{
   struct Screen *Screen;
   struct Window *Window;
   
   if((IntuitionBase = (struct IntuitionBase *)
     OpenLibrary("intuition.library", INTUITION_REV))
     == NULL)
     exit(FALSE);

    if ( (Screen = OpenScreen(&NewScreen) ) == NULL)
      exit(FALSE);

   NewWindow.Screen = Screen; /* Do not forget! */

   if( (Window = OpenWindow(&NewWindow) ) == NULL)
     exit(FALSE);

   /* Wait for Close-Gadget */
   Wait(1 << Window->UserPort->mp_SigBit);

   printf("\nLast window values: %d/%d/%d/%d\n\n",
     Window->LeftEdge,
     Window->TopEdge,
     Window->Width,
     Window->Height  );
   CloseWindow(Window);  /* Close everything in sequence*/
   CloseScreen(Screen);
   CloseLibrary(IntuitionBase);
   exit(TRUE);
}

