Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <dos/dos.h>
- #include <intuition/intuition.h>
- #include <clib/intuition_protos.h>
- #include <clib/graphics_protos.h>
- #include <clib/exec_protos.h>
- struct Library *IntuitionBase;
- int main(void)
- {
- if (IntuitionBase = OpenLibrary("intuition.library", 36))
- {
- struct Window *w;
- if (w = OpenWindowTags(NULL,
- WA_Width, 320,
- WA_Height, 256,
- WA_Title, "Hello Amiga",
- WA_DragBar, TRUE,
- WA_DepthGadget, TRUE,
- WA_CloseGadget, TRUE,
- WA_IDCMP, IDCMP_CLOSEWINDOW,
- TAG_DONE))
- {
- struct RastPort *rp = w->RPort;
- struct TextFont *font = rp->Font;
- struct MsgPort *mp = w->UserPort;
- BOOL done = FALSE;
- /* Draw text */
- Move(rp, w->BorderLeft, w->BorderTop + font->tf_Baseline);
- SetAPen(rp, 1);
- Text(rp, "Hello Amiga!", 12);
- while (!done)
- {
- struct IntuiMessage *msg;
- /* Wait for user event */
- WaitPort(mp);
- /* Process user messages */
- while ((!done) && (msg = (struct IntuiMessage *)GetMsg(mp)))
- {
- ULONG class = msg->Class;
- UWORD code = msg->Code;
- switch (class)
- {
- case IDCMP_CLOSEWINDOW:
- /* User clicked Close gadget */
- done = TRUE;
- break;
- }
- }
- }
- CloseWindow(w);
- }
- CloseLibrary(IntuitionBase);
- }
- return(RETURN_OK);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement