Thread: allegro help

  1. #1
    Registered User
    Join Date
    Aug 2001
    Posts
    380

    allegro help

    I'm trying to make a 640x480 8bit color pacman clone using Allegro. My problem is that the colors are not being displayed correctly if I draw the lime. What could a solution be other than use some other color depth?

    Thanks for your help.

  2. #2
    Registered User JoshG's Avatar
    Join Date
    Mar 2002
    Posts
    326
    Not sure if this will fix it, but try set_color_depth(8); Or is that the default?

  3. #3
    Registered User
    Join Date
    Aug 2001
    Posts
    380
    I just tried your suggestion and it didn't help.

  4. #4
    Registered User JoshG's Avatar
    Join Date
    Mar 2002
    Posts
    326
    Try using:

    void set_palette(const PALETTE p);

    Passing it the same palette you used when loading the bitmaps.

  5. #5
    Registered User
    Join Date
    Aug 2001
    Posts
    380
    I am setting the palette after the bitmaps are loaded. also, I created the bitmaps in MS Paint and saved them as the 256 color format. That shouldn't be the problem, right?
    Don't you dare hit me on the head, you know I'm not normal.
    A Stooge Site
    Green Frog Software

  6. #6
    Registered User JoshG's Avatar
    Join Date
    Mar 2002
    Posts
    326
    I really don't know, sorry. I always use 32 bit graphics. Is there any specific reason it has to be 8?

  7. #7
    Registered User
    Join Date
    Aug 2001
    Posts
    380
    There's no special reason to use 8 bit other than to have my game to run almost anyones computer
    Don't you dare hit me on the head, you know I'm not normal.
    A Stooge Site
    Green Frog Software

  8. #8
    Registered User JoshG's Avatar
    Join Date
    Mar 2002
    Posts
    326
    Try the allegro.cc forums, I am sure someone there could help you.

  9. #9
    Rambling Man
    Join Date
    Jan 2002
    Posts
    1,050
    Nearly everybody can run at least 16bit color depth so here is a way to get max color depth on everybody's computer...

    Code:
    ofstream filelog("log.txt");
    
    set_color_depth(32);
     if(set_gfx_mode(GFX_AUTODETECT_FULLSCREEN, 800, 600, 0, 0) == 0)
     {
     filelog << "\nset_color_depth(32) initialized";
     filelog << "\nset_gfx_mode(GFX_AUTODETECT_FULLSCREEN 800x600) initialized"; 
     }
     else if(set_gfx_mode(GFX_AUTODETECT_FULLSCREEN, 800, 600, 0, 0) != 0)
     {
     filelog << "\nset_color_depth(32) failed";
     filelog << "\nset_gfx_mode(GFX_AUTODETECT_FULLSCREEN 800x600) failed";
     
      set_color_depth(24);
      if(set_gfx_mode(GFX_AUTODETECT_FULLSCREEN, 800, 600, 0, 0) == 0)
      {
      filelog << "\nset_color_depth(24) initialized";
      filelog << "\nset_gfx_mode(GFX_AUTODETECT_FULLSCREEN 800x600) initialized"; 
      }
      else if(set_gfx_mode(GFX_AUTODETECT_FULLSCREEN, 800, 600, 0, 0) != 0)
      {
      filelog << "\nset_color_depth(24) failed";
      filelog << "\nset_gfx_mode(GFX_AUTODETECT_FULLSCREEN 800x600) failed"; 
      
       set_color_depth(16);
       if(set_gfx_mode(GFX_AUTODETECT_FULLSCREEN, 800, 600, 0, 0) == 0)
       {
       filelog << "\nset_color_depth(16) initialized";
       filelog << "\nset_gfx_mode(GFX_AUTODETECT_FULLSCREEN 800x600) initialized"; 
       }
       else if(set_gfx_mode(GFX_AUTODETECT_FULLSCREEN, 800, 600, 0, 0) != 0)
       {
       filelog << "\nset_color_depth(16) failed";
       filelog << "\nset_gfx_mode(GFX_AUTODETECT_FULLSCREEN 800x600) failed";
       }
      }
     }
    
    filelog.close();
    Btw, I was only doing the filelog stuff because I wanted to see what color depth each computer would be going to.

    Btw numero dos, I have no idea how effective this really is except that it hasn't failed on me once yet. It may cause problems under certain circumstances; I have no idea.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Allegro in C for a newb
    By Ideius in forum C Programming
    Replies: 5
    Last Post: 12-29-2005, 04:36 PM
  2. Game Programming FAQ
    By TechWins in forum Game Programming
    Replies: 5
    Last Post: 09-29-2004, 02:00 AM
  3. double buffering for allegro
    By Leeman_s in forum C++ Programming
    Replies: 6
    Last Post: 09-12-2002, 02:45 PM
  4. Special Allegro Information
    By TechWins in forum Game Programming
    Replies: 12
    Last Post: 08-20-2002, 11:35 PM
  5. Allegro programming in a window
    By Person Man in forum Windows Programming
    Replies: 0
    Last Post: 11-16-2001, 03:23 PM