Mail Archives: djgpp/1998/01/04/04:35:02
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 -