delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/11/14/21:55:26

From: visage AT yourmom DOT com (Visage)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: How Do I Display A Bitmap? W/ Allegro
Date: Sun, 15 Nov 1998 02:46:58 GMT
Organization: Your Mom.Com
Lines: 44
Message-ID: <364e3eb1.16274376@news.flash.net>
References: <72lelm$aed$1 AT autumn DOT news DOT rcn DOT net>
NNTP-Posting-Host: ip128.toledo2.oh.pub-ip.psi.net
X-Newsreader: Forte Free Agent 1.11/32.235
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

On Sat, 14 Nov 1998 21:33:16 -0500, "Travis Gant" <slardy AT erols DOT com>
wrote:

>How do I display a bit map on the screen with allegro?
>Here is what I have so far.

[snip]

It's a start.  Don't feel bad.  I had problems with this too.  Take a
look at my post above, or you can just look at this bit of code
instead... (It might help to view this with a fixed-with font.)

#include <stdio.h>
#include "allegro.h"

BITMAP *bitmap_name;
PALETTE palette_name;

main()
{
	allegro_init();
	set_gfx_mode(GFX_AUTODETECT, width, height, 0, 0);

        /* Load our bitmap into memory. */
	bitmap_name = load_bitmap("filename.xxx", palette_name);

	set_palette(palette_name);

	/* Display the image on the screen. */
	blit(bitmap_name, screen, 0, 0, (SCREEN_W-bitmap_name->w,)/2,
		(SCREEN_H-bitmap_name->h,)/2, bitmap_name->w,
		bitmap_name->h);

	/* Wait for a keypress */
	readkey();
	destroy_bitmap(bitmap_name);
	return 0;
}

If any of this seems wrong to someone out there, let me know. :)  This
is how I did it by reading through the allegro docs and examples.

- Steve

- Raw text -


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