Jump to content
  • Advertisement

Archived

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

[MG]Kaewan

Loading bitmaps from a custom resource file

This topic is 6614 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Just managed to finish off programming my own custom resource file manager (like the one in the tutorials). The files are not compressed in the resource file yet though (maybe later). What I really need to know is how to get a stored bitmap from my resource file onto a directdraw surface. Are there any convinience routines for this, or do I have to do most of the grunt work myself? Thanks! [MG]Kaewan The Mage Guild

Share this post


Link to post
Share on other sites
Advertisement
It really depends on how you did your resource file. Add you reall have to do is get the data from the bitmap (which I assume you can do, if you wrote the file yourself) and copy it into the memory of the surface. You could simply lock the surface and use a loop to copy the data.

------------------------------
Jonathan Little
invader@hushmail.com
http://www.crosswinds.net/~uselessknowledge

Share this post


Link to post
Share on other sites
So basically, I just create a surface with the dimensions of my bitmap, lock it, and then copy the bytes from the resource into the surface. Sounds simple enough.

Thanks!
[MG]Kaewan

The Mage Guild

Share this post


Link to post
Share on other sites
i also used this tutorial to create a resource manager.
only today i created my own sprite format
i am first saving information about how many frames the file has, the bitdepth, the colorkey... then after this header the position in the file of the frames relatively to the beginning, and then the actual data, pixel for pixel.
i am using two bitdepth: 16 and 24. 16 is enough for most of my art, and is 2/3 the size of 24 bits, for the more complex art i use 24 bits.

oh, and one hint: zLib is really ideal for this resource manager to compress data

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!