Mail Archives: djgpp/2000/05/23/15:31:03
how about this one:
The example is taken almost entirely from Allegro Example #15.
IMO you must look through the examples and FAQ as well as post such
questions here.
----------8<------------
#include <stdlib.h>
#include <stdio.h>
#include "allegro.h"
BEGIN_GFX_DRIVER_LIST
GFX_DRIVER_VGA
GFX_DRIVER_VESA1
END_GFX_DRIVER_LIST
BEGIN_COLOR_DEPTH_LIST
COLOR_DEPTH_8
END_COLOR_DEPTH_LIST
BEGIN_DIGI_DRIVER_LIST
END_DIGI_DRIVER_LIST
BEGIN_MIDI_DRIVER_LIST
END_MIDI_DRIVER_LIST
BEGIN_JOYSTICK_DRIVER_LIST
END_JOYSTICK_DRIVER_LIST
int main()
{
PALLETE pal;
BITMAP *bmp;
allegro_init();
install_keyboard();
set_gfx_mode(GFX_VGA, 320, 200, 0, 0);
bmp=load_bitmap("drop.bmp",pal);
if (bmp==NULL) {
allegro_exit();
printf("unable to load image.\n");
return 0;
};
set_palette(pal);
blit (bmp,screen,0,0,(320-bmp->w)/2,(200-bmp->h)/2,bmp->w,bmp->h);
destroy_bitmap (bmp);
readkey();
allegro_exit();
return 0;
}
----------8<------------
Good Luck
Alexei A. Frounze
-----------------------------------------
Homepage: http://alexfru.chat.ru
Mirror: http://members.xoom.com/alexfru
Fredrik Persson wrote:
>
> Hi
> im just wondering how to go about loading and displaying a bitmap on the
> screen?
>
> i`ve tried the foolowing but i have no idea how it should be and cant find
> it anywhere..
>
> void start()
> {
> allegro_init();
> install_keyboard();
> set_gfx_mode(GFX_VGA, 320, 200, 0, 0);
> PALETTE p;
> //RGB *p;
> set_palette(p);
> screen=load_bitmap("drop.bmp",p);
>
> readkey();
> allegro_exit();
> }
>
> i would be very grateful for a quick respons!!!
>
> Thanx
> /Fredrik
- Raw text -