home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1997 #3 / amigamamagazinepolishissue03-1 / ma_1995 / 09 / ami931b.txt < prev    next >
Text File  |  1997-04-07  |  2KB  |  134 lines

  1. ^-
  2. <l>
  3. /* Listing #8 */
  4.  
  5.  
  6.  
  7. #include <proto/dos.h>
  8.  
  9. #include <proto/exec.h>
  10.  
  11. #include <proto/graphics.h>
  12.  
  13. #include <proto/intuition.h>
  14.  
  15.  
  16.  
  17. struct IntuitionBase *IntuitionBase;
  18.  
  19. struct GfxBase *GfxBase;
  20.  
  21. struct Screen *wbscreen, *ekran=0;
  22.  
  23. struct DrawInfo *wbdinfo=0;
  24.  
  25. ULONG wbmodeid;
  26.  
  27.  
  28.  
  29. void wyjscie(int kodpowr)
  30.  
  31. {
  32.  
  33.     if (ekran)
  34.  
  35.         CloseScreen(ekran);
  36.  
  37.     if (wbdinfo)
  38.  
  39.         FreeScreenDrawInfo(wbscreen, wbdinfo);
  40.  
  41.     if (wbscreen)
  42.  
  43.         UnlockPubScreen(0, wbscreen);
  44.  
  45.     CloseLibrary((struct Library*)GfxBase);
  46.  
  47.     CloseLibrary((struct Library*)IntuitionBase);
  48.  
  49.     exit(kodpowr);
  50.  
  51. }
  52.  
  53.  
  54.  
  55. int main(int argc, char *argv[])
  56.  
  57. {
  58.  
  59.     check_os(OS_20);
  60.  
  61.     if (!(IntuitionBase=(struct IntuitionBase*)OpenLibrary("intuition.library", 37)))
  62.  
  63.         return 20;
  64.  
  65.     if (!(GfxBase=(struct GfxBase*)OpenLibrary("graphics.library", 37)))
  66.  
  67.     {
  68.  
  69.         CloseLibrary((struct Library*)IntuitionBase);
  70.  
  71.         return 20;
  72.  
  73.     }
  74.  
  75.     if (((struct Library*)IntuitionBase)->lib_Version<39)
  76.  
  77.     {
  78.  
  79.         if (!(wbscreen=LockPubScreen(0)))
  80.  
  81.             wyjscie(10);
  82.  
  83.         if (!(wbdinfo=GetScreenDrawInfo(wbscreen)))
  84.  
  85.             wyjscie(10);
  86.  
  87.         if ((wbmodeid=GetVPModeID(&wbscreen->ViewPort))==INVALID_ID)
  88.  
  89.             wyjscie(10);
  90.  
  91.         ekran=OpenScreenTags(0,
  92.  
  93.             SA_Width, wbscreen->Width,
  94.  
  95.             SA_Height, wbscreen->Height,
  96.  
  97.             SA_Depth, wbdinfo->dri_Depth,
  98.  
  99.             SA_Title, "Klon Workbencha",
  100.  
  101.             SA_SysFont, 1,
  102.  
  103.             SA_Type, CUSTOMSCREEN,
  104.  
  105.             SA_DisplayID, wbmodeid,
  106.  
  107.             SA_AutoScroll, (wbscreen->Flags & AUTOSCROLL),
  108.  
  109.             SA_Pens, wbdinfo->dri_Pens,
  110.  
  111.             TAG_DONE);
  112.  
  113.     }
  114.  
  115.     else
  116.  
  117.         ekran=OpenScreenTags(0,
  118.  
  119.             SA_Title, "Klon Workbencha",
  120.  
  121.             SA_LikeWorkbench, TRUE,
  122.  
  123.             TAG_DONE);
  124.  
  125.     if (!ekran)
  126.  
  127.         wyjscie(10);
  128.  
  129.     Delay(500);
  130.  
  131.     wyjscie(0);
  132.  
  133. }
  134.