Jump to content
  • Advertisement
Sign in to follow this  
ed209

Why do I need a source and a destination rectangle?

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

What exactly is the destination rectangle for when drawing sprites? I juat started up managed directx again and am having trouble finding information about it. This is probably a dumb question but it would help me greatly. Thanks.

Share this post


Link to post
Share on other sites
Advertisement
The destination rectangle defines where your going to put the sprite on the screen. Using it, you can stretch/shrink the sprite.

If original sprite is 32x32 and your destination rectangle is defined as (0,0,64,64) then the sprite would be scaled to fit a 64x64 area.

Managed DirectX is depreciated (though you can still use it I suppose). Xna is good though. And there is SlimDX.

Share this post


Link to post
Share on other sites
Think of it like this.
You have a piece of paper with alot of photos/pictures printed on it... You have a photo album. You want to cut out some of these pictures/photos and place it in the album.

The source rectangle is where you are going to cut out a picture/photo. The destination is where you are going to place the photo/picture in the album. (With the exception of the fact that you can change the size of the destination rectangle

Source Rectangle : From Where
Destination Rectangle : To Where

I hope this helps.
Take care.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!