Jump to content
  • Advertisement
Sign in to follow this  

Point sprites using ID3DXSprite

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

Right now I have a sprite class that retrieves a sprite interface from the graphics class, with this class I can render sprites to a dimention. So if my dimension was set at 640x480, and the screen is 1280x1024 the sprites would be displayed at 2X the scale to compensate for the screen difference. Now I want to beable to use point sprites and since I have this class I was kind of hoping I could make use of it in the same way. Now I believe that if a flag of D3DXSPRITE_SORT_DEPTH_BACKTOFRONT or D3DXSPRITE_SORT_DEPTH_FRONTTOBACK is supplied to Begin() then it will use the z-buffer to sort all of the quads that are rendered. What I'm wondering is if I supply a z value will it change the scale of the sprites (I'm trying to avoid that)? Here's my current Draw function:
bool cSprite::Draw()
        if(graphics == NULL || texture == NULL)
            return false;
        if(graphics->GetSprite() == NULL)
            return false;

        D3DXMATRIX mat;
        float AspectX = graphics->GetWidth() / m_view.x;
        float AspectY = graphics->GetHeight() / m_view.y;

        D3DXVECTOR2 tempcenter((m_center.x * AspectX), (m_center.y * AspectY));
        D3DXVECTOR2 temptranslation((m_position.x * AspectX), (m_position.y * AspectY));    
        D3DXVECTOR2 tempscale((m_scale.x * AspectX), (m_scale.y * AspectY));


        return SUCCEEDED(graphics->GetSprite()->Draw(texture->GetTexture(), &pSrcRect, NULL, NULL, m_colour));

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!