Mail Archives: djgpp/1999/08/22/14:00:39
Message-ID: | <37C02173.CA2EF624@telusplanet.com>
|
From: | Mike Kalyniuk <kalyniuk AT telusplanet DOT com>
|
X-Mailer: | Mozilla 4.04 [en] (Win95; I)
|
MIME-Version: | 1.0
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Re: Allegro: sprite-draw problems
|
References: | <Fipn3.380$ay DOT 63314 AT news DOT tli DOT de>
|
Lines: | 49
|
Date: | Sun, 22 Aug 1999 15:16:54 GMT
|
NNTP-Posting-Host: | 161.184.233.98
|
X-Trace: | news1.telusplanet.net 935335014 161.184.233.98 (Sun, 22 Aug 1999 09:16:54 MDT)
|
NNTP-Posting-Date: | Sun, 22 Aug 1999 09:16:54 MDT
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
I'm a newbie too but I think you have to directly access the datafile in the
draw_sprite function. ie. draw_sprite(bmp, data[skater001].dat,0,0);
Mike.
Amin Kharchi wrote:
> Hello!
>
> I'm new in Allegro and C. I wanted to draw a sprite to the Screen, the
> sprite is a BMP in the .dat-file. And I have generated a header with the
> tool dat.exe.
>
> Now I have tried to draw the sprite/bitmap with draw_sprite(), but it
> failed. The error is "cannot convert type DATAFILE to type BITMAP". But how
> can I do this???
>
> Here is my listing (it's small :-):
> #include <allegro.h>
> #include "skater.h"
>
> int main()
> {
> allegro_init(); // Init and Screenmode
> set_color_depth(8);
> set_gfx_mode(GFX_VESA1,640,480,0,0);
> BITMAP *bmp = create_bitmap(640,480); // bmp is virtual-screen
>
> char file[11]="skater.dat";
> DATAFILE *data;
> BITMAP *sprite;
> data = load_datafile(file); // Load datafile with BMP's
>
> clear(bmp);
> sprite = data[skater001]; // Sprite skater001 is defined in skater.h
> draw_sprite(bmp,sprite,0,0); // This function want a BITMAP*!
>
> blit(bmp,screen,0,0,0,0,320,200);
> getch();
> }
>
> I don't know how to do it else. Or is it totaly false???
>
> Thanx for your help!
>
> Amin
> PS: I'm german - sorry for my english ;-)
- Raw text -