Hmm, I was just using the RectsOverlap function above and found that it claims rects overlap when they are merely adjacent. For example a 10x10 rect is sitting next to another one. The first one is at 0,0 and the second one is at 10,0. So the test goes:
Is 0 > (10+10)? No so it does the next test ...
Is (0+10) < 10? No so it it checks the Y coords.
If I reduce the width that I pass in by 1 it's fine.
It can be be fixed by changing all the comparisons to >= and <=. However, I also changed the function to take floats, but that didn't seem to work as well when I passed in floating coords, hmm.
So beware...
Is 0 > (10+10)? No so it does the next test ...
Is (0+10) < 10? No so it it checks the Y coords.
If I reduce the width that I pass in by 1 it's fine.
It can be be fixed by changing all the comparisons to >= and <=. However, I also changed the function to take floats, but that didn't seem to work as well when I passed in floating coords, hmm.
So beware...