home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / euphoria / select.e < prev    next >
Text File  |  1994-01-31  |  869b  |  31 lines

  1.         -------------------------------------
  2.         -- search for a good graphics mode --
  3.         -------------------------------------
  4.  
  5. constant nice_color_modes = {261,18,260,259,258,257,256,19,16,14,13,4},
  6.      nice_mono_modes = {17, 11, 15, 6, 5}
  7.  
  8. global function select_mode(integer choice)
  9. -- Try to select the choice mode, but if it fails try other modes.
  10. -- This is not guaranteed to work - you may have to set the mode
  11. -- yourself by editing the code.
  12.     sequence vc, modes
  13.     integer fail
  14.  
  15.     vc = video_config()
  16.     if vc[VC_COLOR] then
  17.     modes = choice & nice_color_modes
  18.     else
  19.     modes = choice & nice_mono_modes
  20.     end if
  21.     for i = 1 to length(modes) do
  22.     fail = graphics_mode(modes[i])
  23.     vc = video_config()
  24.     if not fail and vc[VC_XPIXELS] > 40 and vc[VC_YPIXELS] > 40 then
  25.         return 1    
  26.     end if
  27.     end for
  28.     return 0
  29. end function
  30.  
  31.