Loading bitmaps from a custom resource file
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
The Mage Guild
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
------------------------------
Jonathan Little
invader@hushmail.com
http://www.crosswinds.net/~uselessknowledge
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
Thanks!
[MG]Kaewan
The Mage Guild
The Mage Guild
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
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
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement