home *** CD-ROM | disk | FTP | other *** search
/ The CDPD Public Domain Collection for CDTV 4 / CDPD_IV.bin / networking / dnet / dnet2.3.2 / amiga / suplib / intuition.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-29  |  1.7 KB  |  96 lines

  1.  
  2. /*
  3.  *  INTUITION.C
  4.  */
  5.  
  6. #include <local/typedefs.h>
  7.  
  8. extern struct IntuitionBase *IntuitionBase;
  9.  
  10. void
  11. SetNewScreen(ns, type, xscr)
  12. NS *ns;
  13. ulong type;
  14. SCR *xscr;
  15. {
  16.     SCR scr;
  17.  
  18.     if (!IntuitionBase)
  19.     OpenIntuitionLibrary();
  20.  
  21.     scr.ViewPort.Modes = HIRES;
  22.     scr.Width  = 640;
  23.     scr.Height = 200;
  24.     scr.BitMap.Depth = 2;
  25.     GetScreenData((char *)&scr, sizeof(scr), type, xscr);
  26.     if (!ns->Height) {
  27.     ns->Height= scr.Height;
  28.     if ((ns->ViewModes & LACE) != (scr.ViewPort.Modes & LACE)) {
  29.         if (ns->ViewModes & LACE)
  30.         ns->Height <<= 1;
  31.         else
  32.         ns->Height >>= 1;
  33.     }
  34.     }
  35.     if (!ns->Width) {
  36.     ns->Width = scr.Width;
  37.     if ((ns->ViewModes & HIRES) != (scr.ViewPort.Modes & HIRES)) {
  38.         if (ns->ViewModes & HIRES)
  39.         ns->Width <<= 1;
  40.         else
  41.         ns->Width >>= 1;
  42.     }
  43.     }
  44.     if (ns->Depth == 0 && (ns->Type & CUSTOMBITMAP) && ns->CustomBitMap)
  45.     ns->Depth = ns->CustomBitMap->Depth;
  46.     if (ns->Depth == 0)
  47.     ns->Depth = scr.BitMap.Depth;
  48. }
  49.  
  50. /*
  51.  *  GetStdWidth()
  52.  *
  53.  *  Returns standard screen width for HIRES mode
  54.  */
  55.  
  56. int
  57. GetStdWidth()
  58. {
  59.     SCR scr;
  60.  
  61.     if (!IntuitionBase)
  62.     OpenIntuitionLibrary();
  63.     GetScreenData((char *)&scr, sizeof(scr), WBENCHSCREEN, NULL);
  64.     if (scr.ViewPort.Modes & HIRES)
  65.     return((int)scr.Width);
  66.     return(scr.Width << 1);
  67. }
  68.  
  69.  
  70. /*
  71.  *  GetStdHeight()
  72.  *
  73.  *  Returns standard screen height for non-interlace mode
  74.  *  (whether or not the workbench is interlaced)
  75.  */
  76.  
  77. int
  78. GetStdHeight()
  79. {
  80.     SCR scr;
  81.     if (!IntuitionBase)
  82.     OpenIntuitionLibrary();
  83.     GetScreenData((char *)&scr, sizeof(scr), WBENCHSCREEN, NULL);
  84.     if (scr.ViewPort.Modes & LACE)
  85.     return((int)scr.Height >> 1);
  86.     return((int)scr.Height);
  87. }
  88.  
  89. void
  90. OpenIntuitionLibrary()
  91. {
  92.     IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library", 0);
  93. }
  94.  
  95.  
  96.