Jump to content
  • Advertisement
Sign in to follow this  
Emil_Halim

how to resize 2D sprite

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

Advertisement
There are many ways to resize a sprite. But it depends how your sprite is stored, whether you're working in D3D or OpenGL, or even writing your own software rasterizer, etc.

Share this post


Link to post
Share on other sites
Quote:
Original post by Emil_Halim
a few days ago i learned how to rotate 2D , Now i want Resizing.
Your rotation function can do scaling too. Just multiply the cos/sin rotation vector by a scaling constant.
It's not as efficient as a decicated a sprite scaler but at least you won't have to write much code.

Share this post


Link to post
Share on other sites
Hi doynax

thanks for your help. i will try it and let you know the result.

actually i am using rotate & resize for a percalculated some sprite, so it is
not for real time animation.

Share this post


Link to post
Share on other sites
it works very well but you need to change the next line

outerDeltaV = -innerDeltaU;

to

outerDeltaV = innerDeltaU;

and

innerDeltaU = cos(3.14*2) * ScaleFactor;
innerDeltaV = sin(3.14*2) * ScaleFactor;

question :

how can i make 2 scale factors, one (ScaleX) for width and outher (ScaleY) for height.



thanks for help

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!