Sign in to follow this  
ed209

Why do I need a source and a destination rectangle?

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
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

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