Archived

This topic is now archived and is closed to further replies.

McMcDonald

Loading bitmaps from memory

Recommended Posts

Hi! I want to write a simple game that comes with one file without the need to run install procedures. I packed graphics (bmp) and sound into an arj, added the arj as a resource to the .exe. The extraction from the arj-data works, i can load the soundfiles. But i have problems to load the bitmap data. There are functions to load bitmaps from file or resource, but what i need is a possibility to load a bitmap from memory or direct from a byte stream that comes out from my arj extract function. Are there any ideas ? Thanks McMc

Share this post


Link to post
Share on other sites
Sure there is, go to www.cplusplus.com/src, go down to windows programs, and download BMP Loader. It opens the BMP from a file, so you could just modify that so it takes the stream from memory instead of a file.

Share this post


Link to post
Share on other sites
You don''t even need to bother with that. If you are trying to just have a single executable file, just add your bitmaps into the project and compile them as a resource... then you can use all the load and manipulation functions you want.

-- And that''s my $0.02 worth --

Hang on, where I come from, $0.02 is rounded down. Does that mean my opinion is worthless or priceless?

CHROM

Share this post


Link to post
Share on other sites
@gph-gw
Thanks! The source will help me solving the problem.

@psychic_treason
Thanks for your reply too. I know reading resources is simple. But my resource is an ARJ that must be unpacked before loading the content into a surface. And that was the problem...

McMc

Share this post


Link to post
Share on other sites
I think there is a function within the windows standard functions that also reads bitmaps from memory. Look at LoadBitmap
in MSDN and look for links.

Electron

"64 kb of memory ought to be enough for anybody-Bill gates -89


Share this post


Link to post
Share on other sites
Putting everything into 1 file is a very bad idea...
Don''t put anything in with your game executable...

If you make an update to your game (new game exe) then everyone would have to redownload all the graphics and sound that didn''t change to!

It''s better to make 1 game exe and a resource pak.

I agree with not putting all files seperately on the users HD... I returned Wizards & Warriors to the store because it installed like 70.000!!! files on my hd!

Share this post


Link to post
Share on other sites