Jump to content
  • Advertisement
Sign in to follow this  
Overdrive

Problem with ID3DXSprite

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

This is bothering me for some time, and I did not manage to find an answer to my problem by searching the net, and so I am posting this here. I am using ID3DXSprite to draw my sprites on screen All works nice when the RECT* parameter of the Draw() function is NULL (it draws all the texture). Now the problem begins when I try to draw a piece of my sprite sheet. I found the sprite sheet here: http://xnagamedev.com/xna-basics/how-to-animate-sprites-via-sprite-sheets-in-xna-game-studio-express It looks like this: Image Hosted by ImageShack.us<br/> One frame has it's size of 50x95. I use a RECT with properties right = 50, bottom = 95, top = left = 0. After i call Sprite->Draw() with these parameters, it apears that only a quarter of the frame is drawn: Image Hosted by ImageShack.us<br/> I think that some scaling is done too, because the original resolution is not kept. Can anyone help me with this problem? [Edited by - Overdrive on March 7, 2008 9:43:05 AM]

Share this post


Link to post
Share on other sites
Advertisement
Make sure your sprite sheet image file is save as a "power-of-2" size ... such as 1024 wide x 128 high (in this case).

When you are loading your current file into a texture, it is probably being stretched to a power-of-2 size, which is why you would be seeing scaling (and blurriness).

Also, if a frame is 50x95, why wouldn't you make your rect be 50x95?

-Matt

Share this post


Link to post
Share on other sites
It was a typo, fixed now. My rect is 50x95.
Thanks for the replay, i'll try your solution.

L.E: Yup. It works now. Thanks!

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!