PDA

Click to See Complete Forum and Search --> : help! this scrolling is given me a bad time!


drewski
Nov 27th, 2001, 12:52 AM
Hey people, does anyone know how to make this work. Here's what I've been trying to do:

I have my screen which is 17 x 13 tiles (I think) and in the memory I have stored a surface that is 18 x 13 which is rebilted with every frame in individual tiles. I have this working with maps that are bigger that the screen but the problem is this is somewhat slow because there are 234 different blts going on here.

What I am now trying to do is blt only the edges where the player is moving to because that is the only new part being shown on the screen. I was going to move the stuff already blted over and blt the new border at the edge. I cant get this to work. The output that I get when I try to do this is some pretty weird stuff! The out put may be weird but it does improve my framerate dramatically. Does anyone know how to do this and make it work right?! This is really agrivating me.


Thanks for the help.



Drewski

drewski
Nov 27th, 2001, 01:01 AM
Oops. Sorry the stored surface is actually 18 x 14.

drewski
Nov 28th, 2001, 03:46 PM
Hasn't anybody ever done this before? What have all you done with your own projects that you're working on?

TType85
Nov 30th, 2001, 06:11 PM
Are you using Direct Draw? If so there is a way to just blt the areas that need to be updated (dirty rectangles?) its in the DX7 SDK and i'll try to look it up this weekend.

Sastraxi
Nov 30th, 2001, 07:10 PM
Here's a way to clip rectangles for the screen:Function ClipRect(ScreenW As Long, ScreenX As Long, X As Long, Y As Long, Width As Long, Height As Long) As RECT
ClipRect.Left = X
ClipRect.Top = Y
ClipRect.Right = X + Width
ClipRect.Bottom = Y + Height
If ClipRect.Left < 0 Then ClipRect.Left = Abs(ClipRect.Left)
If ClipRect.Top < 0 Then ClipRect.Top = Abs(ClipRect.Top)
If ClipRect.Right > ScreenW Then ClipRect.Right = ClipRect.Right - (ClipRect.Right - ScreenW)
If ClipRect.Bottom > ScreenH Then ClipRect.Bottom = ClipRect.Bottom - (ClipRect.Bottom - ScreenH)
ClipRect.Left = ClipRect.Left - X
ClipRect.Top = ClipRect.Top - Y
ClipRect.Right = ClipRect.Right - X
ClipRect.Bottom = ClipRect.Bottom - Y
End FunctionJust pass this as the Rect for the source, not the destination.

drewski
Dec 6th, 2001, 10:21 PM
Hey Sastraxi, thats not quite what I was looking for. What TType85 was talking about was more along the lines of what I need to do. What I'm trying to do it to blt the least amount of times as possible to the screen. What I've been doing it blting each and every tile that is on the screen. This isn't very efficient beause it gives me over 200 blts. I was thinking that the only part of the screen that displays new tiles are the edges. So, this would be the only part that needs to be reblted. After the edges are reblted I just move the part that hasn't been changed over to make space for the newly blted tiles. Well, I haven't been able to get this to work so I came here for a little help.

TType85 is you find that example please let me know. I am using DDraw in DX7.

Thanks guys.


Drewski