Mercurial > pygame
changeset 3157:28f0dd33b024
Merged in Dreamsorcerer/pygame-rect-intersection2 (pull request #11: Optimise rect intersection)
| author | illume <renesd@gmail.com> |
|---|---|
| date | Thu, 03 Jan 2013 13:20:36 +0100 |
| parents | 879fabe08772 (current diff) 4f65c537da28 (diff) |
| children | 4eb2576561e0 |
| files | |
| diffstat | 1 files changed, 4 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/rect.c Thu Jan 03 13:13:08 2013 +0100 +++ b/src/rect.c Thu Jan 03 13:20:36 2013 +0100 @@ -164,10 +164,10 @@ static int DoRectsIntersect (GAME_Rect *A, GAME_Rect *B) { - return ((A->x >= B->x && A->x < B->x + B->w) || - (B->x >= A->x && B->x < A->x + A->w)) && - ((A->y >= B->y && A->y < B->y + B->h) || - (B->y >= A->y && B->y < A->y + A->h)); + //A.topleft < B.bottomright && + //A.bottomright > B.topleft + return (A->x < B->x + B->w && A->y < B->y + B->h && + A->x + A->w > B->x && A->y + A->h > B->y); } static PyObject*
