Jump to content
  • Advertisement
Sign in to follow this  

scaling sprites

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

Using directX9.0 and ID3DXSprite How can I scale sprites? Make them larger or smaller, without changing the actual bitmap file. this is the draw function HRESULT Draw( LPDIRECT3DTEXTURE9 pTexture, CONST RECT *pSrcRect, CONST D3DXVECTOR3 *pCenter, CONST D3DXVECTOR3 *pPosition, D3DCOLOR Color ); The old draw function had a scaling vector. Anyone have any suggestions?

Share this post

Link to post
Share on other sites
You can use the SetTransform() function to set a scaling transform. Something like this (untested):

D3DXMATRIX matView, matProj, matScale, matFinal;
matFinal = matScale*matView*matProj;

That should scale by 2.0 in X and 0.5 in Y. Z isn't used, so you'll usually want to set it to 1.0.
And you need the view and projection matrices, because SetTransform() wants a matrix to translate from world space to screen space, not from model space to world space (which you'd just set matScale for).

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!