Jump to content
  • Advertisement
Sign in to follow this  
ApolloGod

Problem with D3DXSprite

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

I have the following code from VB draws a sprite to the screen with color blending "alpha". When I initialize the sprite object, I use the hex color &HFFFFFFFF, which should alpha blend and make the background of the sprite transparent, but it still shows as pink. What color do I use to make the sprite opaque and background transparent on the terrain? Thanks. Public Sub SpriteDraw( _ ByRef tex As Direct3DTexture8, _ ByRef spr As TSPRITE, _ ByVal alpha As Long) Dim vecPos As D3DVECTOR2 vecPos.x = spr.x vecPos.y = spr.y Dim vecScale As D3DVECTOR2 vecScale.x = spr.ScaleFactor vecScale.y = spr.ScaleFactor Dim vecRot As D3DVECTOR2 vecRot.x = 0 vecRot.y = 0 spr.spriteObject.Begin Dim r As DxVBLibA.RECT r.Left = (spr.CurrentFrame Mod spr.FramesPerRow) * spr.width r.Top = (spr.CurrentFrame \ spr.FramesPerRow) * spr.height r.Right = r.Left + spr.width r.bottom = r.Top + spr.height spr.spriteObject.Draw tex, r, vecScale, vecRot, 0, vecPos, alpha spr.spriteObject.End End Sub

Share this post


Link to post
Share on other sites
Advertisement
Actually....just found the error. It was in LoadTexture, not SpriteDraw. I had incorrectly identified the colorkey in CreateTextureFromFile (I forgot to add the alpha value in the hex code).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!