Advertisement
Guest User

Amiga Shopper UI Example

a guest
Apr 4th, 2017
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.93 KB | None | 0 0
  1. #include <exec/types.h>
  2. #include <intuition/intuition.h>
  3. #include <intuition/intuitionbase.h>
  4. #include <clib/intuition_protos.h>
  5. #include <clib/exec_protos.h>
  6. #include <clib/graphics_protos.h>
  7.  
  8. struct GfxBase *GfxBase;
  9. struct Library *IntuitionBase;
  10.  
  11. struct RastPort *rp;
  12.  
  13. struct TextAttr TextFont = {
  14.     "topaz.font",
  15.     8,0,0
  16. };
  17.  
  18. struct Window *CurrentWindow;
  19. struct Screen *CurrentScreen;
  20. struct IntuiMessage *message;
  21.  
  22.   struct NewScreen InitScreen = {
  23.   0,0,
  24.   640,200,
  25.   3,
  26.   0,1,
  27.   HIRES,
  28.   CUSTOMSCREEN,
  29.   &TextFont,"Our Custom Screen",NULL
  30.   };
  31.  
  32.   struct NewWindow InitWindow = {
  33.   0,11,
  34.   640,189,
  35.   0,1,
  36.   MOUSEBUTTONS | CLOSEWINDOW,
  37.   ACTIVATE | WINDOWCLOSE,
  38.   NULL,
  39.   NULL,
  40.   "Four in a row",
  41.   NULL,
  42.   NULL,
  43.   0,0,640,189,
  44.   CUSTOMSCREEN
  45.   };
  46.  
  47. void setupdisplay()
  48.     {
  49.     GfxBase=(struct GfxBase *)OpenLibrary("graphics.library",0);
  50.     if (GfxBase==NULL) exit (100);
  51.     IntuitionBase=(struct Library *) OpenLibrary ("intuition.library",0);
  52.     if (IntuitionBase==NULL) {
  53.     CloseLibrary((struct Library *)GfxBase);
  54.     exit(200);
  55.     }
  56.  
  57. CurrentScreen=(struct Screen*) OpenScreen(&InitScreen);
  58.     if (CurrentScreen==NULL) {
  59.     CloseLibrary(IntuitionBase);
  60.     CloseLibrary((struct Library *)GfxBase);
  61.     exit (300);
  62.     }
  63.  
  64. InitWindow.Screen=CurrentScreen;
  65.  
  66. CurrentWindow=(struct Window *) OpenWindow (&InitWindow);
  67.  
  68.     if (CurrentWindow==NULL) {
  69.     CloseScreen(CurrentScreen);
  70.     CloseLibrary(IntuitionBase);
  71.     CloseLibrary((struct Library *)GfxBase);
  72.     exit (400);
  73. }
  74. rp=CurrentWindow->RPort;
  75. }
  76.  
  77. void closedown()
  78. {
  79. CloseWindow(CurrentWindow);
  80. CloseScreen(CurrentScreen);
  81. CloseLibrary(IntuitionBase);
  82. CloseLibrary((struct Library *)GfxBase);
  83. }
  84.  
  85. void main()
  86. {
  87. unsigned long int class;
  88. setupdisplay();
  89. do {
  90. while ((message=(struct IntuiMessage *)GetMsg (CurrentWindow->UserPort))==NULL);
  91. class=message->Class;
  92.  
  93. ReplyMsg(message);
  94. } while (class!=CLOSEWINDOW);
  95. closedown();
  96. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement