/* * Article 27 of net.micro.amiga: * ion: version B 2.10.2 9/17/84 chuqui version 1.9 3/12/85; site unisoft.UUCP * Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site topaz.RUTGERS.EDU * Path: unisoft!dual!lll-crg!seismo!columbia!topaz!eric * From: eric@topaz.RUTGERS.EDU (Eric Lavitsky) * Newsgroups: net.micro.amiga * Subject: Hello World * Message-ID: <3529@topaz.RUTGERS.EDU> * Date: 4 Sep 85 20:12:41 GMT * Date-Received: 5 Sep 85 16:38:36 GMT * Organization: Rutgers Univ., New Brunswick, N.J. * Lines: 145 * * Hi, * * Well here is the first ever Amiga source to be posted on the net. The * following code was taken from the Amiga User Interface Manual. This * program uses the Intuition user interface under V28 of the operating * system. Intuition controls all the window sizing and dragging for the * application, though you can tell Intuition to tell your program about * certain events (like resizing) so you can take your own action. The * code is not ultimately clean - all the structures could be initialized * like the first one etc. I kept most of the original comments from the * example and added one or two of my own. * * The program opens its own screen (320x200) and creates a window that * can be dragged, sized, pushed up or down and closed. The screen can also * be pushed down or popped up and be pulled down to reveal the screen below * it (one of my favorite features!) * * Enjoy! * */ /*************************************************************************** * * "Hello World" * **************************************************************************/ #include #include #include struct IntuitionBase *IntuitionBase; struct GfxBase *GfxBase; #define INTUITION_REV 28 /* You must be sure this is correct */ #define GRAPHICS_REV 28 /* This font declaration will be used for our new screen */ struct TextAttr MyFont = { "topaz.font", /* Font Name * TOPAZ_SIXTY, /* Font Height */ FS_NORMAL, /* Style */ FPF_ROMFONT /* Preferences */ }; /* This is the declaration of a pre-initialized NewScreen data block. * It often requires less work, and often uses less code space, to * pre-initialize data structures in this fashion. */ struct NewScreen NewScreen = { 0, /* the LeftEdge should be equal to zero */ 0, /* TopEdge */ 320, /* Width (lo-resolution) */ 200, /* Height (non-interlace) */ 2, /* Depth (16 colors will be available) */ 0, 1, /* the DetailPen and BlockPen specifications */ NULL, /* no special display modes */ CUSTOMSCREEN, /* the Screen Type */ &MyFont, /* Use my own font */ "My Own Screen", /* this declaration is compiled as a text pointer */ NULL, /* no special Screen Gadgets */ NULL /* no special Custom BitMap */ }; main() { struct Screen *Screen; struct NewWindow NewWindow; struct Window *Window; /* Open the Intuition library. The result returned by this call is * used to connect your program to the actual Intuition routines * in ROM. If the result of this call is zero, something is wrong * and the Intuition you requested is not available, so your program * should exit immediately */ IntuitionBase = (struct IntuitionBase *) OpenLibrary("intuition.library",INTUITION_REV); if(IntuitionBase == NULL) exit(FALSE); GfxBase = (struct GfxBase *) OpenLibrary("graphics.library",GRAPHICS_REV); if(GfxBase == NULL) exit(FALSE); if((Screen = (struct Screen *) OpenScreen(&NewScreen)) == NULL) exit(FALSE); /* Initialize the NewWindow structure for the call to OpenWindow() */ NewWindow.LeftEdge = 20; NewWindow.TopEdge = 20; NewWindow.Width = 300; NewWindow.Height = 100; NewWindow.DetailPen = 0; NewWindow.BlockPen = 1; NewWindow.Title = "A Simple Window"; NewWindow.Flags = WINDOWCLOSE | SMART_REFRESH | ACTIVATE | WINDOWSIZING | WINDOWDRAG | WINDOWDEPTH; NewWindow.IDCMPFlags = CLOSEWINDOW; /* Tell us about CLOSEWINDOW events */ NewWindow.Type = CUSTOMSCREEN; NewWindow.FirstGadget = NULL; NewWindow.CheckMark = NULL; NewWindow.Screen = Screen; NewWindow.BitMap = NULL; NewWindow.MinWidth = 100; NewWindow.MinHeight = 25; NewWindow.MaxWidth = 32767; NewWindow.MaxHeight = 32767; /* Try to open the window. Like the call to OpenLibrary(), if * the OpenWindow call is successful, it returns a pointer to * the structure for your new window. If the OpenWindow() call * fails, it returns a zero. */ if(( Window = (struct Window *) OpenWindow(&NewWindow)) == NULL) exit(FALSE); Move(Window->RPort,20,20); Text(Window->RPort,"Hello World",11); for(;;) { Wait(1 << Window->UserPort->mp_SigBit); CloseWindow(Window); /* Close the Window */ CloseScreen(Screen); /* Close the Screen */ exit(TRUE); /* Exit */ } }