Blitting Bitmap Problem
I'm reading LaMothe's Tricks of the Windows Game Programming Gurus, but some of his samples won't play correctly. The program is supposed to display three identical creatures, except in size, walking around. What it shows on my computer is static in their place, walking around. If you have the book, the programs are:
demo7_13, demo7_14, are the only ones that do it, and I don't know why. How can I expect to understand code when it doesn't even work right on my computer?
Any help will be much appreciated.
Edited by - nobodynews on January 27, 2001 7:28:44 PM
Make sure you order a new cd for the book, the first one did have that problem... It''s all free.
The problem you''re having is that the code doesn''t work for bitmaps not divisable by four. The width (in BYTES!) of a scanline of the bitmap must be divisable by four. If that is not the case it''s padded with zero''s ''til it is... That''s why it looks like garbage on screen. To solve this you can create some "pad eating" code, or simply make all the sprite bitmaps 80x80 (easy!). You can also use DDSCAPS_SYSTEMMEMORY whilst filling out the DDSCAPS2 structure, instead of using DDSCAPS_VIDEOMEMORY (not recommended ''cause you all hardware acceleration by doing this). Hope this helps!
The problem you''re having is that the code doesn''t work for bitmaps not divisable by four. The width (in BYTES!) of a scanline of the bitmap must be divisable by four. If that is not the case it''s padded with zero''s ''til it is... That''s why it looks like garbage on screen. To solve this you can create some "pad eating" code, or simply make all the sprite bitmaps 80x80 (easy!). You can also use DDSCAPS_SYSTEMMEMORY whilst filling out the DDSCAPS2 structure, instead of using DDSCAPS_VIDEOMEMORY (not recommended ''cause you all hardware acceleration by doing this). Hope this helps!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement