packing a sprite from memory

Advanced game related topics
User avatar
Hroudtwolf
Addict
Addict
Posts: 803
Joined: Sat Feb 12, 2005 3:35 am
Location: Germany(Hessen)
Contact:

packing a sprite from memory

Post by Hroudtwolf »

LADYS & GENTLEMAN :D

How to pack a sprite from memory in a packfile without temporarily storing as bitmapfile.
I need it for my mapeditor for include all used sprites in a mapfile.
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6172
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

unpack memory then catch image?
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB - upgrade incoming...)
( The path to enlightenment and the PureBasic Survival Guide right here... )
Ralf
Enthusiast
Enthusiast
Posts: 203
Joined: Fri May 30, 2003 1:29 pm
Location: Germany

Re: packing a sprite from memory

Post by Ralf »

Hroudtwolf wrote:LADYS & GENTLEMAN :D

How to pack a sprite from memory in a packfile without temporarily storing as bitmapfile.
I need it for my mapeditor for include all used sprites in a mapfile.
hi!
if i understand you right, you want pack your sprites and include it into your exe!? then at runtime you want to unpack your sprites to memory and catch them?

its no problem...

you have to know the size of each unpacked sprite, then you have to allocate memory and have to copy the unpacked sprite into the new allocatedmemory ! so your sprite is unpacked in memory and you know its memory adress! now you can use CatchSprite() and put the adress of the unpacked sprite... that should be all :-)

but hey, this way dont make any sence for me! if you want it, to save some memory, then you could add your sprites (packed or unpacked) as resource! because resources are not loaded into memory as included stuff!
User avatar
Hroudtwolf
Addict
Addict
Posts: 803
Joined: Sat Feb 12, 2005 3:35 am
Location: Germany(Hessen)
Contact:

Post by Hroudtwolf »

hi!
if i understand you right, you want pack your sprites and include it into your exe!? then at runtime you want to unpack your sprites to memory and catch them?
Not that isn't the problem.
I want to create some sprites while the runtime of my mapeditor and then , I want to save this sprites directly from spritememory into a packfile.
Post Reply