delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/07/27/17:41:30

From: "Amin Kharchi" <kharchi AT gmx DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Allegro: sprite-draw problems
Lines: 43
X-Newsreader: Microsoft Outlook Express 4.72.3110.5
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
Message-ID: <Fipn3.380$ay.63314@news.tli.de>
Date: Tue, 27 Jul 1999 23:10:52 +0200
NNTP-Posting-Host: 195.252.134.120
X-Complaints-To: newsmaster AT tli DOT de
X-Trace: news.tli.de 933110053 195.252.134.120 (Tue, 27 Jul 1999 23:14:13 MET DST)
NNTP-Posting-Date: Tue, 27 Jul 1999 23:14:13 MET DST
Organization: Talkline Internet Division http://www.tli.de
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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 -


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