Version 2.0!
Features
Tutorials
Files
Glossary
Projects
Contact
Links
Message Board
Extras
LuckyCam
Old News
Sign Guestbook
View Guestbook
VB Horoscope
VB Photo Album
.
ATTENTION READERS! Lucky's VB Gaming Site is no longer active. For updated game programming information and tutorials, please visit The Game Programming Wiki!

Zooming

So what if you want to display a bitmap at 1/2 the ordinary size? Or twice the ordinary size? You'd need to ZOOM, wouldn't you? Well, zoom through this tutorial and you'll be zooming in no time! (WEAK!)

Dim Zoom as Single

    With DestRect
      .Bottom = 60 * Zoom
      .Left = 0
      .Right = 60 * Zoom
      .Top = 0
    End With

    BackBuffer.Blt DestRect, Ship(Facing), SrcRect, DDBLT_KEYSRC Or DDBLT_WAIT

All you have to do is multiply the size of the destination rectangle by some fraction and the "BackBuffer.Blt" function will handle the stretching of the bitmap to fit the size you give it. Just multiply the size of the sprite by the "Zoom" variable to obtain this effect. If you alter the "Zoom" variable below 1, you will be zooming out (making your sprite smaller), if you alter the "Zoom" variable above 1 you will be zooming in (making your sprite larger).

Have a look at my DirectX 7 sample project to see it in action.