BMP loaders...

Started by
3 comments, last by VersusReal 21 years, 8 months ago
Is it better to write your own bmp loader for a game, or to use the DirectDraw functions? I just got Windows Game Programming for Dummies and I''m wondering which is better. Thanks!!! Open the hushed casket...
Open the hushed casket...
Advertisement
I''d say it''s much better to write your own BMP loader. The BMP file format is very simple so writing a loader for it isn''t too much trouble at all and then at least you can say it''s your own code. I didn''t have experience writing file loaders before but I was able to put together a BMP load function just from studying the BMP data structures in the Windows API. I suggest you start from there. Look up the BITMAPFILEHEADER and BITMAPINFOHEADER data structures. All you need to know is in there.
If you want to write your own bitmap loader, take a look at this post. One of the replyers has written quiet a big piece about loading a bitmap. Although he only tells about 24bit->16bit bitmaps it''s a start. Hope it helps.

sand Hawk

----------------
-Earth is 98% full. Please delete anybody you can.


My Site
----------------(Inspired by Pouya)
There is also a code snippet on planet source code, fatty. search under "bitmap load loadbitmap", because the title is something like "load a bitmap without using the loadbitmap function".
i''ve also put some info that i''ve been using for the past few days to write my own loader at this link along with the code i''ve written so far (use the code for whatever): http://www.killfactory.com

the sole purpose of the WindowManager.h header included is to provide an easy way to code MessageBoxes. you can strip out that code and it will compile. it''s buggy as hell, but the comments, at least should help some.

it should be noted that the _only_ files i''ve tested this with so far are 8-bit greyscale BMP files. the loader can''t yet handle compression or 24-bit bitmaps. theoretically it should work for 4, 16 & 32-bit maps too, but since when does theory work out?

-me

This topic is closed to new replies.

Advertisement