Saturday, September 03, 2005

Scrolling a 2D Background: Trouble a brewing!

Well, after doing the post yesterday with a small little code sample of how I was scrolling my 2D background, I stumbled across a LITTLE problem.

I began working on my project on another computer and lo and behold the Managed DirectX function Draw2D was not recognized.

So I'm going to have to do some research into which computer has the newest DirectX 9 dlls and figure out wether Draw2D will be in the final relase or will not be in the final release. Until then, I have fixed my code using the standard Draw function which is seems to work fine in both versions.

I'll update my final findings on this matter once it has been cleared up for me.

Drawing the 2D background using the standard Draw function.

'Scroll and draw the Background
Public Sub Draw()
    mBackgroundSprite.Begin(SpriteFlags.AlphaBlend)
    mBackgroundTextureSize = New Rectangle(mXPosition, _
      0, mWidth, mHeight)

    mBackgroundSprite.Draw(mBackgroundSpriteTexture, _
      mBackgroundTextureSize(0), New Vector3(0, 0, 0), _
      New Vector3(0, 0, 0), TransparentColor)

    mBackgroundSprite.End()
    mXPosition += 1
End Sub


Basically using the Draw function is very similar to using the Draw2D function, you'rejust passingin vectors now instead of a point.

0 Comments:

Post a Comment

<< Home