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

struct IntuitionBase *IntuitionBase;
struct GfxBase *GfxBase;

/*  Struktur für neues Window initialisieren:  */
struct NewWindow NewWindow =
{
   170,80,              /* linke obere Ecke    */
   300,100,             /* Breite u. Höhe      */
   -1,-1,               /* Farbe der Pens      */
   CLOSEWINDOW,         /* Meldung wenn        */

   WINDOWCLOSE   |      /* Window-Gadgets      */
   WINDOWSIZING  |
   WINDOWDRAG    |
   WINDOWDEPTH   |
   SMART_REFRESH |      /* Refresh-Art          */
   ACTIVATE,            /* aktiv nach Open()    */

   NULL,                /* keine User-Gadgets   */
   NULL,                /* keine User-CheckMark */
   "Mein Window",       /* Window-Titel         */
   0,                   /* Kein eigener Screen  */
   NULL,                /* keine SuperBitmap    */
   100,                 /* Mindestbreite        */
   30,                  /* Mindesthöhe          */
   640,                 /* Maximalbreite        */
   256,                 /* Maximalhöhe          */
   WBENCHSCREEN         /* Bildschirmtyp        */
};

main()
{
   struct Window *Window;
   struct RastPort *rp;

   /* Zwei Libraries öffnen, bei Fehler Exit: */
   IntuitionBase =
   (struct IntuitionBase *) OpenLibrary("intuition.library",0L);
   if (IntuitionBase == NULL)  exit(FALSE);

   GfxBase =
   (struct GfxBase *) OpenLibrary("graphics.library",0L);
   if (GfxBase == NULL)
   {
      CloseLibrary(IntuitionBase);
      exit(FALSE);
   }

   /* Window öffnen, bei Fehler Exit: */
   Window =
   (struct Window *) OpenWindow(&NewWindow);

   if (Window == NULL)
   {
      CloseLibrary(GfxBase);
      CloseLibrary(IntuitionBase);
      exit(FALSE);
   }

   /* Rastport beschaffen und Text ausgeben:      */
   rp = Window->RPort;           /* Der Rastport  */
   SetAPen(rp, 1L);              /* Farbe weiß    */
   Move(rp, 100, 50);            /* Cursor -> x,y */
   Text(rp, "Hallo Welt!",11L);  /* Text zeichnen */

   /* Auf Message warten,
      kann hier hier nur Close sein: */
   Wait(1L << Window->UserPort->mp_SigBit);

   CloseWindow(Window);        /* Alles schließen */
   CloseLibrary(GfxBase);
   CloseLibrary(IntuitionBase);

   exit(TRUE);                 /*   und Ende      */
}

