Sign in to follow this  
  • entries
    686
  • comments
    1952
  • views
    386227


5 Comments


Recommended Comments

If I have time, I'll try to port it to Mac OS X. Have you done anything Windows-specific that I should look out for?

Share this comment


Link to comment
Quote:
Original post by Ravuya
If I have time, I'll try to port it to Mac OS X. Have you done anything Windows-specific that I should look out for?


No, I don't think I have. All of it just uses the base SDL libraries.

Share this comment


Link to comment
I'm at work, so I just typed this up, but I think it's right. (You'll wanna test it out.)

This improves two things.
1) Pass by const reference, so the program's not making unnecessary copies.
2) Fewer comparisons.

Hope you don't mind me trying to help.


bool Intersect(const SDL_Rect &r1, const SDL_Rect &r2)
{
if((r1.x < r2.x + r2.w) && (r1.x + r1.w > r2.x) &&
(r1.y < r2.y + r2.h) && (r1.y + r1.h > r2.y))
{
return true;
}

return false;
}

Share this comment


Link to comment

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