home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Exec 4 / CD_Magazyn_EXEC_nr_4.iso / Recent / dev / c / GSys.lha / gsys / ggraphics / GRequestDisplay.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-30  |  3.9 KB  |  209 lines

  1.  
  2. #ifndef GREQUESTDISPLAY_CPP
  3. #define GREQUESTDISPLAY_CPP
  4.  
  5. #include "ggraphics/GRequestDisplay.h"
  6. #include "gsystem/GObject.cpp"
  7.  
  8. GRequestDisplay::GRequestDisplay(GTagItem *TagList)
  9. {
  10.         /* Default settigns */
  11.         DesWidth = 640;
  12.         DesHeight = 480;
  13.         DesDepth = 24;
  14.  
  15.         MinWidth = 320;
  16.         MinHeight = 200;
  17.         MinDepth = 16;
  18.  
  19.         MaxWidth = 1280;
  20.         MaxHeight = 1024;
  21.         MaxDepth = 24;
  22.  
  23.         Depth = 0;
  24.         Height = 0;
  25.         Width = 0;
  26.  
  27.         NextGRequestDisplay = NULL;
  28.  
  29. #ifdef GAMIGA
  30.         ScrModeRequester = NULL;
  31. #endif
  32.  
  33.         while (TagList->TagItem)
  34.         {
  35.             switch (TagList->TagItem)
  36.             {
  37.                 case RD_DESWIDTH:
  38.                     DesWidth = TagList->TagData;
  39.                 break;
  40.                 case RD_DESHEIGHT:
  41.                     DesHeight = TagList->TagData;
  42.                 break;
  43.                 case RD_DESDEPTH:
  44.                     DesDepth = TagList->TagData;
  45.                 break;    
  46.  
  47.                 case RD_MINWIDTH:
  48.                     MinWidth = TagList->TagData;
  49.                 break;
  50.                 case RD_MINHEIGHT:
  51.                     MinHeight = TagList->TagData;
  52.                 break;
  53.                 case RD_MINDEPTH:
  54.                     MinDepth = TagList->TagData;
  55.                 break;
  56.  
  57.                 case RD_MAXWIDTH:
  58.                     MaxWidth = TagList->TagData;
  59.                 break;
  60.                 case RD_MAXHEIGHT:
  61.                     MaxHeight = TagList->TagData;
  62.                 break;
  63.                 case RD_MAXDEPTH:
  64.                     MaxDepth = TagList->TagData;
  65.                 break;
  66.             }
  67.             TagList++;
  68.         }
  69. #ifdef GAMIGA
  70.  
  71.         if (ScrModeRequester = (struct ScreenModeRequester *)AllocAslRequestTags(ASL_ScreenModeRequest,
  72.             ASLSM_Window, NULL,
  73.             ASLSM_PubScreenName, NULL,
  74.             ASLSM_Screen, NULL,
  75.             ASLSM_PrivateIDCMP, FALSE,
  76.             ASLSM_TitleText, (ULONG) ((char *) "Please Select ScreenMode"),
  77.             ASLSM_InitialWidth, 256,
  78.             ASLSM_InitialHeight, 200,
  79.             ASLSM_InitialDisplayWidth, DesWidth,
  80.             ASLSM_InitialDisplayHeight, DesHeight,
  81.             ASLSM_InitialDisplayDepth, DesDepth,
  82.             ASLSM_DoWidth, TRUE,
  83.             ASLSM_DoHeight, TRUE,
  84.             ASLSM_DoDepth, TRUE,
  85.             ASLSM_MinWidth, MinWidth,
  86.             ASLSM_MinHeight, MinHeight,
  87.             ASLSM_MinDepth, MinDepth,
  88.             ASLSM_MaxWidth, MaxWidth,
  89.             ASLSM_MaxHeight, MaxHeight,
  90.             ASLSM_MaxDepth, MaxDepth,
  91.             TAG_DONE))
  92.         {
  93.             if (AslRequest((APTR)ScrModeRequester, NULL))
  94.             {
  95.  
  96.                 Width = ScrModeRequester->sm_DisplayWidth;
  97.                 Height = ScrModeRequester->sm_DisplayHeight;
  98.                 Depth = ScrModeRequester->sm_DisplayDepth;
  99.                 Status = TRUE;
  100.             }
  101.             else
  102.             {
  103.                 Status = FALSE;
  104.                 Width = 0;
  105.                 Height = 0;
  106.                 Depth = 0;
  107.             }
  108.         }
  109.         else Status = FALSE;
  110. #endif
  111.  
  112. #ifdef GDIRECTX
  113. #endif
  114.  
  115. }
  116.  
  117. GRequestDisplay::~GRequestDisplay()
  118. {
  119. #ifdef GAMIGA
  120.     if (ScrModeRequester) FreeAslRequest((APTR)ScrModeRequester);
  121. #endif
  122. #ifdef GDIRECTX
  123. #endif
  124. }
  125.  
  126.  
  127. BOOL GRequestDisplay::RequestNewDisplayMode(GTagItem *TagList)
  128. {
  129.     /* Default settigns */
  130.     DesWidth = 640;
  131.     DesHeight = 480;
  132.     DesDepth = 24;
  133.  
  134.     MinWidth = 320;
  135.     MinHeight = 200;
  136.     MinDepth = 16;
  137.  
  138.     MaxWidth = 1280;
  139.     MaxHeight = 1024;
  140.     MaxDepth = 24;
  141.  
  142.     while (TagList->TagItem)
  143.     {
  144.         switch (TagList->TagItem)
  145.         {
  146.             case RD_DESWIDTH:
  147.                 DesWidth = TagList->TagData;
  148.             break;
  149.             case RD_DESHEIGHT:
  150.                 DesHeight = TagList->TagData;
  151.             break;
  152.             case RD_DESDEPTH:
  153.                 DesDepth = TagList->TagData;
  154.             break;
  155.  
  156.             case RD_MINWIDTH:
  157.                 MinWidth = TagList->TagData;
  158.             break;
  159.             case RD_MINHEIGHT:
  160.                 MinHeight = TagList->TagData;
  161.             break;
  162.             case RD_MINDEPTH:
  163.                 MinDepth = TagList->TagData;
  164.             break;
  165.  
  166.             case RD_MAXWIDTH:
  167.                 MaxWidth = TagList->TagData;
  168.             break;
  169.             case RD_MAXHEIGHT:
  170.                 MaxHeight = TagList->TagData;
  171.             break;
  172.             case RD_MAXDEPTH:
  173.                 MaxDepth = TagList->TagData;
  174.             break;
  175.         }
  176.         TagList++;
  177.     }
  178.  
  179. #ifdef GAMIGA
  180.  
  181.     if (AslRequestTags((APTR)ScrModeRequester,
  182.         ASLSM_InitialDisplayWidth, DesWidth,
  183.         ASLSM_InitialDisplayHeight, DesHeight,
  184.         ASLSM_InitialDisplayDepth, DesDepth,
  185.         ASLSM_MinWidth, MinWidth,
  186.         ASLSM_MinHeight, MinHeight,
  187.         ASLSM_MinDepth, MinDepth,
  188.         ASLSM_MaxWidth, MaxWidth,
  189.         ASLSM_MaxHeight, MaxHeight,
  190.         ASLSM_MaxDepth, MaxDepth,
  191.         TAG_DONE))
  192.     {
  193.  
  194.         Width = ScrModeRequester->sm_DisplayWidth;
  195.         Height = ScrModeRequester->sm_DisplayHeight;
  196.         Depth = ScrModeRequester->sm_DisplayDepth;
  197.         return TRUE;
  198.     }
  199.     else return FALSE;
  200. #endif
  201.  
  202. #ifdef GDIRECTX
  203. #endif
  204.  
  205. }
  206.  
  207. #endif /* GREQUESTDISPLAY_CPP */
  208.  
  209.