delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/27/16:23:40

From: Temujin <temujin AT sentex DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Allegro -- Direct copying of RLE sprites
Date: Wed, 27 Aug 1997 10:33:26 -0700
Organization: Sentex Communications
Lines: 38
Message-ID: <340464E6.4674@sentex.net>
References: <34034596 DOT 157 AT indy DOT net>
NNTP-Posting-Host: 207.245.212.213
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Chris Frolik wrote:
> 
> Is there a fast and easy way to copy RLE sprites?  If anyone has written
> a function to do this, I'd appreciate some help.  The way I am using now
> is slow and tedious.  For example:
> 
> /* copy_rle_sprite(sprite) -- returns a copy of sprite.  This does more
>  * than just copy the pointers -- it copies the data they point to.
>  */
> 
> RLE_SPRITE *copy_rle_sprite(RLE_SPRITE *sprite)
> {
>    RLE_SPRITE *new_sprite;
>    BITMAP *temp = create_bitmap(sprite->w, sprite->h);
>    if (!temp) return NULL;
> 
>    clear(temp);
>    draw_rle_sprite(temp, sprite, 0, 0);
> 
>    new_sprite = get_rle_sprite(temp);
>    destroy_bitmap(temp);
>    return new_sprite;
> }
> 
> I know this method of creating a bitmap is disgusting and slow.  Is
> there a faster way to avoid the "middle-man" and just copy from one
> RLE_SPRITE to another?
> 
> Thanks,
> -Chris

Couldn't you just do something like, after assigned  sprite as an
RLE_SPRITE   and giving it an image just do like.
RLE_SPRITE *newsprite
newsprite=sprite

That would assign the pointer over to it, just a thought, haven't tried
it.

- Raw text -


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