From: "Smith A. Cat" Newsgroups: comp.os.msdos.djgpp Subject: Re: Easy to answer Graphics Quetion Date: 5 Jun 1997 19:34:01 -0700 Organization: Blue Square Laboratories Lines: 74 Message-ID: <33977515.7612@primenet.com> References: <01bc71d7$9375a7c0$6f1cd6cc AT chia> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------18F020602CAB" To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk This is a multi-part message in MIME format. --------------18F020602CAB Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Chia wrote: > I am rather new to this and only have got the compiler to work a couple > days ago. I can make some really nice graphics with some various programs > and would like to be able to put them into either C or C++ code. I've been > trying to figure it out on my own but all I can find is long sets of code > and I haven't seen how I can just display an image. Is there a way to just > take a .bmp or any other kind of file and display it? Thanks! Allegro comes with an example program, i think ex15.c: --------------18F020602CAB Content-Type: text/plain; charset=us-ascii; name="EX15.C" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="EX15.C" /* * Example program for the Allegro library, by Shawn Hargreaves. * * This program demonstrates how to load and display a bitmap file. */ #include #include #include "allegro.h" int main(int argc, char *argv[]) { BITMAP *the_image; PALLETE the_pallete; if (argc != 2) { printf("Usage: 'ex15 filename.[bmp|lbm|pcx|tga]'\n"); return 1; } /* read in the bitmap file */ the_image = load_bitmap(argv[1], the_pallete); if (!the_image) { printf("Error reading bitmap file '%s'\n", argv[1]); return 1; } allegro_init(); install_keyboard(); set_gfx_mode(GFX_VGA, 320, 200, 0, 0); /* select the bitmap pallete */ set_pallete(the_pallete); /* blit the image onto the screen */ blit(the_image, screen, 0, 0, (SCREEN_W-the_image->w)/2, (SCREEN_H-the_image->h)/2, the_image->w, the_image->h); /* destroy the bitmap */ destroy_bitmap(the_image); readkey(); return 0; } --------------18F020602CAB--