Jump to content
  • Advertisement
Sign in to follow this  
_Zac_

[SDL] SDL_Rect question

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

If I put in a rectangle that has x and y equal 0, and the width and height equal to 32, and then blit it, would it draw a rectangle from 0 to 31 x and y? (So top-left corner is at (0,0) and the bottom-right corner is at (31,31))

Thanks, I need to know this because I created a collision-detection function that takes in a rectangle's x,y,width and height and that one pixel could make all the difference.

Share this post


Link to post
Share on other sites
Advertisement
To actually answer your question, yes, it would go from (0,0) to (31,31). This is because it spans 32 pixels, 0 inclusive, so therefore the final coordinates will be (w-x-1, h-y-1).

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!