Mail Archives: djgpp/1998/11/14/21:55:26
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 -