delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/04/04:35:02

From: Konstanty Bialkowski <M DOT Bialkowski AT mailbox DOT uq DOT edu DOT au>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: newbie allegro 3.0 question
Date: Sun, 04 Jan 1998 18:44:36 +1000
Organization: University of Queensland
Lines: 40
Message-ID: <34AF4BF3.7D9E3D70@mailbox.uq.edu.au>
References: <883853520 DOT 249102343 AT dejanews DOT com>
Reply-To: M DOT Bialkowski AT mailbox DOT uq DOT edu DOT au
NNTP-Posting-Host: csmbialk.slip.cc.uq.edu.au
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp


akubisuru AT yahoo DOT com wrote:

> How can I save/load RLE sprites to files without
> using datafiles?
>

To display an rle sprite you need to first load it as a normal bitmap:eg.
Loading a file into an rle_sprite:
BITMAP *inbetween;
PALETTE *pal;
RLE_SPRITE* the_rle_sprite;
// note the file can me bmp,pcx,tga and lbm
inbetween=load_bitmap("file.bmp",pal);
the_rle_sprite=get_rle_sprite(inbetween);
draw_rle_sprite(screen, the_rle_sprite, 10, 10);
destroy_bitmap(inbetween);
...
..
.

Saving an rle_sprite to a file:
(starting with an rle_sprite in memory called the_rle_sprite)
RLE_SPRITE* the_rle_sprite;
..
.
BITMAP *inbetween;
PALETTE *pal;
inbetween=create_bitmap(the_rle_sprite->w,the_rle_sprite->h);
clear(inbetween);
draw_rle_sprite(inbetween, the_rle_sprite, 0, 0);

save_bitmap("file.bmp", inbetween, pal);
 // note the file does not need to be a .bmp file

hope this answers your question,
Konstanty
http://kon.home.ml.org/

- Raw text -


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