Mail Archives: djgpp/1999/08/23/15:43:13
| From: | "OmniMeta" <meta AT abacom DOT com> | 
| Newsgroups: | comp.os.msdos.djgpp | 
| References: | <7pi4ti$r7e$1 AT bgtnsc01 DOT worldnet DOT att DOT net> | 
| Subject: | Re: 24-bit help | 
| Lines: | 40 | 
| X-Priority: | 3 | 
| X-MSMail-Priority: | Normal | 
| X-Newsreader: | Microsoft Outlook Express 5.00.2014.211 | 
| X-MimeOLE: | Produced By Microsoft MimeOLE V5.00.2014.211 | 
| Message-ID: | <Hhdw3.322$Os5.51294@wagner.videotron.net> | 
| Date: | Mon, 23 Aug 1999 10:56:52 -0300 | 
| NNTP-Posting-Host: | 207.253.161.60 | 
| X-Complaints-To: | abuse AT videotron DOT net | 
| X-Trace: | wagner.videotron.net 935420135 207.253.161.60 (Mon, 23 Aug 1999 10:55:35 EDT) | 
| NNTP-Posting-Date: | Mon, 23 Aug 1999 10:55:35 EDT | 
| To: | djgpp AT delorie DOT com | 
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp | 
| Reply-To: | djgpp AT delorie DOT com | 
Ramon J. Long Jr. <RLongJr AT worldnet DOT att DOT net> a écrit dans le message :
7pi4ti$r7e$1 AT bgtnsc01 DOT worldnet DOT att DOT net...
> ok... my game is using all 24-bit images.  my problem is that i don't know
> how to set up a 24 bit color depth.  could some one please help?
>
If you are using the Allegro Game Library, you can do it like this
#include "allegro.h"
#include <stdio.h>
char SetVideoMode();
int main()
{
    allegro_init();
    install_keyboard();
    if(SetVideoMode())
    {
        line(screen, 0,0, 639, 479, 0xff0000);
        readkey();
    }
    else
    {
        printf("\nError setting video mode !\n");
        return 1;
    }
    return 0;
}
char SetVideoMode()
{    // return true if it worked
    set_color_depth(24);
    if ( ! (set_gfx_mode(640,480,0,0) ) )
        return 1;
    else
        return 0;
}
- Raw text -