delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/12/30/15:15:37

From: "DeHackEd" <dehacked72 AT nospam DOT hotmail DOT com>
References: <199712301340 DOT PAA23345 AT tag DOT starnets DOT ro>
Subject: Re: Image & Sound
Date: Tue, 30 Dec 1997 11:05:48 -0500
Lines: 43
Message-ID: <#SVtl7VF9GA.225@upnetnews03>
Newsgroups: comp.os.msdos.djgpp
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Allegro tends to be very popular with DJGPP programmers. To display a .BMP file,
for example, just type:

#include <allegro.h>
#include <conio.h>

main()
{
    BITMAP *bmp;
    PALETTE pal;     // doesn't matter if spelled wrong

    allegro_init();
    bmp = load_bitmap("image.bmp", pal);
    if (!bmp) // did not load
        return 1;

    set_gfx_mode(GFX_AUTODETECT, 640, 480, 0, 0);
    set_palette(pal);
    draw_sprite(screen, bmp, 0, 0);
    getch();
    allegro_exit();
}

Displays image "image.bmp" on the screen using resolution 640x480 and the
pictures own natural 256 colour bitmap (deithered if necessary).


--
"DeHackEd"
Remove "nospam." from my email address to reply.
It's too late to run when you hear the boom.


Korenschi Francisc Eduard wrote in message
<199712301340 DOT PAA23345 AT tag DOT starnets DOT ro>...
> Hello from Romania,
>
>   Could anyone tell me where can I find some sources for diplaying various
>Graphic format and playing different sort of sounds ?
>
>   Thanx anticipated for bothering


- Raw text -


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