Advertisement
RSzacki

Untitled

May 2nd, 2021
1,135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.34 KB | None | 0 0
  1. #include <dos/dos.h>
  2. #include <intuition/intuition.h>
  3. #include <clib/intuition_protos.h>
  4. #include <clib/graphics_protos.h>
  5. #include <clib/exec_protos.h>
  6.        
  7. struct Library *IntuitionBase;
  8.        
  9. int main(void)
  10. {
  11.     if (IntuitionBase = OpenLibrary("intuition.library", 36))
  12.     {
  13.         struct Window *w;
  14.                
  15.         if (w = OpenWindowTags(NULL,
  16.             WA_Width,       320,
  17.             WA_Height,      256,
  18.             WA_Title,       "Hello Amiga",
  19.             WA_DragBar,     TRUE,
  20.             WA_DepthGadget, TRUE,
  21.             WA_CloseGadget, TRUE,
  22.             WA_IDCMP,       IDCMP_CLOSEWINDOW,
  23.             TAG_DONE))
  24.         {
  25.             struct RastPort *rp = w->RPort;
  26.             struct TextFont *font = rp->Font;
  27.             struct MsgPort *mp = w->UserPort;
  28.             BOOL done = FALSE;
  29.                    
  30.             /* Draw text */
  31.             Move(rp, w->BorderLeft, w->BorderTop + font->tf_Baseline);
  32.             SetAPen(rp, 1);
  33.             Text(rp, "Hello Amiga!", 12);                      
  34.            
  35.             while (!done)
  36.             {
  37.                 struct IntuiMessage *msg;
  38.                        
  39.                 /* Wait for user event */
  40.                 WaitPort(mp);
  41.                        
  42.                 /* Process user messages */
  43.                 while ((!done) && (msg = (struct IntuiMessage *)GetMsg(mp)))
  44.                 {
  45.                     ULONG class = msg->Class;
  46.                     UWORD code = msg->Code;
  47.                            
  48.                     switch (class)
  49.                     {
  50.                         case IDCMP_CLOSEWINDOW:
  51.                             /* User clicked Close gadget */
  52.                             done = TRUE;
  53.                             break;
  54.                     }
  55.                 }
  56.             }
  57.             CloseWindow(w);                
  58.         }
  59.         CloseLibrary(IntuitionBase);           
  60.     }
  61.     return(RETURN_OK);
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement