Jump to content
  • Advertisement

Archived

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

lpsoftware

scrolling problems

This topic is 6930 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

Hi, it seems that there's a problem in my DirectX, tile-based, scrolling game. The scrolling is working just fine except that when scrolling up or down (it only scrolls vertically) the upper or bottom row is cut off until the next row takes it's place and so on, and it creates a very bad effect. I'm pretty sure that it's just a problem when drawing to the secondary surface (for flipping) and nothing is drawn when a part of the bmp is outside of the surface. Also, anything that overlaps the surface is immediately not shown. Is there some blatant mistake that I'm making? I'll post the code if necessary. Thanks, Martin Edited by - lpsoftware on 4/26/00 9:52:07 PM

Share this post


Link to post
Share on other sites
Advertisement
It seems like you need to do something called clipping, the easiest way is to use a direct draw clipper but this is not compatible with BltFast.

Another way is to write your own clipper where you draw the tiles that will go over the edge of the screen and change the size of a rectangle that defines how much of the tile to show.

ex: if your tiles are 64x64 and the tile goes over the edge of the screen by 4 pixels at the bottom of the screen, you change the rectangle of the tile to
RECT tileRect = {0,0,64,60};
This way only 60 pixels of the height of the tile are shown and the 4 pixels off the screen are not shown

This is probably the best way. Unfortunatly i don't have nice, well commented, code to show you, but i'm sure someone else can help you implement this.

The third way to do this is to put your entire map onto a large surface in system memory and blt pieces of the map the size of the screen. However, this limits the size of your map to the amt. of sys. memory.

i'll bet that your using a tile size that evenly divides into the width of the screen but not the height that's why everything is ok when you scroll left to right.

+AA_970+

Edited by - +AA_970+ on 4/26/00 10:05:45 PM

Share this post


Link to post
Share on other sites
+AA_970+: Thanks for the help. I knew that I was supposed to be doing some clipping, I just didn''t know that the Ddraw clipper wasn''t compatible with Blt_Fast, which I''m using to do my blitting.

Don''t worry about not having some nice code to show me, I think I can figure it out

Again, thanks.
Martin

Share this post


Link to post
Share on other sites
Just switch from BltFast to Blt and your problems are solved. Since your stuff is all done on the video card, the 2 functions operate at the same speed. You ARE on the video card right?

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!