Sign in to follow this  

New here and need a little help

Recommended Posts

First off, hello. Second, I'm making a DirectDraw 2D game in Visual Basic and am encountering a weird glitch. I have a 1.2 MB background map which I have loaded onto a surface and can succesfully Blit that to the BackBuffer and flip it. Also my computer has no trouble in moving around the map which is about 6 times larger than my screen. However, my problem comes when I try to zoom out from it. As the image is 6720, 3664 I would like to grant the user the ability to zoom out, but when Zoom <> 1 when I do so there is a massive smearing effect on the displayed picture.
Public Sub DisplaySprite()
'posTop is an integer holding the current position for the top of
 'the rectangle on the background map
'posLeft is an integer holding the current left position
'Zoom is a double indicating level to multiply by
'Map is the Surface holding the background map

Dim SrcRect As RECT
Dim DestRect As RECT
     'Set up the source rectangle
     With SrcRect
         .Bottom = (posTop + 768) * Zoom
         .Left = posLeft
         .Right = (posLeft + 1024) * Zoom
         .Top = posTop
     End With
     'Set up the destination rectangle
     With DestRect
         .Bottom = 768
         .Left = 0
         .Right = 1024
         .Top = 0
     End With
     'Blit the surface on to the backbuffer
     BackBuffer.Blt DestRect, Map, SrcRect, DDBLT_KEYSRC Or DDBLT_WAIT
End Sub
So basically what I'm trying to do is take an area out of the Map Surface that's, for example, (1229, 921) and place it on the BackBuffer at (1024, 768) Any ideas as to why it's smearing it? Thanks for any help, and if you need any more info (more code, screenshots, etc, let me know)

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this