Jump to content
  • Advertisement
Sign in to follow this  
Ninja2008

ID3DXSprite scaling and positioning problem

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

Hey guys..

I am in the final steps of making my engine, only I got this problem in the sprites part.......I am loading all sprites in single "begin" and "end" calls..which is the fastest way I used a sprite manager I made to do that...now to the problem.....when scaling the sprite....it seems that the position is scaled too...I mean if I write in code to put the sprite at X=80, it actually appears at (80 * scale in X direction)....if scaling in x direction is 3, then the sprite appears at X=80* 3...this is disturbing.....anybody know a way to get rid of this....

thanks..

Share this post


Link to post
Share on other sites
Advertisement
Actually I am just asking if anyone of you got problem with scaling sprites, it seems that when you scale the sprite, everything must be tweaked to work, which is not very cool thing to do..and i don't have problem with coding...only I am tweaking things up to get the result, but I don't think this is correct to do.....

Share this post


Link to post
Share on other sites
Still can't help without seeing what code we're talking about....sprite scaling is dead easy....but you're not providing enough info to help.

Share this post


Link to post
Share on other sites

Hey guys..

I am in the final steps of making my engine, only I got this problem in the sprites part.......I am loading all sprites in single "begin" and "end" calls..which is the fastest way I used a sprite manager I made to do that...now to the problem.....when scaling the sprite....it seems that the position is scaled too...I mean if I write in code to put the sprite at X=80, it actually appears at (80 * scale in X direction)....if scaling in x direction is 3, then the sprite appears at X=80* 3...this is disturbing.....anybody know a way to get rid of this....

thanks..


I believe by default id3xsprite position coords use the upper left corner as the starting point for drawing. I have some static properties which define the location with which to drqw the sprite relative to. You always nave to take into account the scaling when applying the transform if it is not linked to Tue top left corner. Just multiply by the scaling factor and you should be fine.

Edit: prob the easiest way of doing this is to define an offset property which is multiplied by the scaling factor to produce the final transform.

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!