Sign in to follow this  

Problem with ID3DXSprite

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

This topic is 3566 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this