www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/10/07/20:07:46

From: "Arthur" <arfa AT clara DOT net>
To: <djgpp AT delorie DOT com>
Subject: RE: Using bitmaps in Allegro
Date: Wed, 7 Oct 1998 22:50:24 +0100
Message-ID: <000001bdf23c$7d148be0$554e08c3@arthur>
MIME-Version: 1.0
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook 8.5, Build 4.71.2173.0
Importance: Normal
In-Reply-To: <01bdf21a$953398a0$2947f482@s-64584>
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
Reply-To: djgpp AT delorie DOT com

> I can't get it to work.
> Lets say I have this file _file_.bmp and I want to load it and draw it on
> my screen(or a screenbuffer or another bitmap) which functions need to be
> called (and in what order). I'm very newbie but I really like to learn and
> I chosed Allegro after several tries making an own library for graphics.
> And it's mode 13h.
> Thanks.

try the following:

BITMAP *picture;        /* The BITMAP struct contains the width and height
                           of the image file, and a pointer to where the
actual
                           data is in memory */
extern BITMAP *screen;  /* A pointer to the BITMAP for screen data */

void display(void)
{
	picture = load_bitmap("_file_.bmp");   /* load the file into picture */

	/* Check to see if picture is loaded here */

	blit(picture, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H);
                                             /* Draw it to the screen */
}

int main(void)
{
	/* This is where all the initialisation stuff goes */

	/* Make sure you set up allegro_init and set_gfx_mode properly */

	display();

	return 0;
}

You may like to check out the example programs which come with Allegro, and
you can join the Allegro Mailing List.

James Arthur
jaa AT arfa DOT clara DOT net
ICQ#15054819

- Raw text -


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