delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/02/08/06:51:50

From: "Jimbo" <rpgfreak AT lineone DOT net>
Newsgroups: alt.games.programming,comp.os.msdos.djgpp
Subject: Setting graphics modes in Win2k
Date: Thu, 8 Feb 2001 11:38:12 -0000
Organization: Posted via Supernews, http://www.supernews.com
Message-ID: <t851ba7dbs3g5f@corp.supernews.co.uk>
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2919.6700
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700
X-Complaints-To: newsabuse AT supernews DOT com
Lines: 50
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Does anyone know what is going on? I am trying to set the graphics mode in
Allegro and it won't open the screen on Windows 2000. Any ideas anyone?!

Code follows:

--------------------------------------------------------------------
int cscreen::init(int sw_, int sh_, int depth_)
{
   sw = sw_;
   sh = sh_;

   // set the screen mode... first try the specified depth
   set_color_depth(depth_);

   if (set_gfx_mode(GFX_AUTODETECT, sw, sh, 0, 0) != 0) {
      // cannot set specified depth... find best depth
      set_color_depth(32);
      if (set_gfx_mode(GFX_AUTODETECT, sw, sh, 0, 0) != 0) {
         set_color_depth(24);
         if (set_gfx_mode(GFX_AUTODETECT, sw, sh, 0, 0) != 0) {
            set_color_depth(16);
            if (set_gfx_mode(GFX_AUTODETECT, sw, sh, 0, 0) != 0) {
               set_color_depth(15);
               if (set_gfx_mode(GFX_AUTODETECT, sw, sh, 0, 0) != 0) {
                  set_color_depth(8);
                  if (set_gfx_mode(GFX_AUTODETECT, sw, sh, 0, 0) != 0)
                     return 4;
               }
            }
         }
      }
   }

   PALETTE pal;

   // in case this is a 256 colour mode, generate a nice palette
   generate_332_palette(pal);
   set_palette(pal);

   clear_to_color(screen, makecol(0, 0, 0));

}
--------------------------------------------------------------------

The program returns 4 and outputs "cannot set graphics mode".

Thanks in advance,
Jamie.


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019