diff --git a/desktop_version/src/UtilityClass.cpp b/desktop_version/src/UtilityClass.cpp index e186c82c..cd2a54c4 100644 --- a/desktop_version/src/UtilityClass.cpp +++ b/desktop_version/src/UtilityClass.cpp @@ -173,40 +173,7 @@ std::string UtilityClass::number( int _t ) bool UtilityClass::intersects( SDL_Rect A, SDL_Rect B ) { - int leftA, leftB; - int rightA, rightB; - int topA, topB; - int bottomA, bottomB; - //Calculate the sides of rect A - leftA = A.x; - rightA = A.x + A.w; - topA = A.y; - bottomA = A.y + A.h; - //Calculate the sides of rect B - leftB = B.x; - rightB = B.x + B.w; - topB = B.y; - bottomB = B.y + B.h; - - if( bottomA <= topB ) - { - return false; - } - if( topA >= bottomB ) - { - return false; - } - if( rightA <= leftB ) - { - return false; - } - if( leftA >= rightB ) - { - return false; - } - //If none of the sides from A are outside B return true; } - - return true; + return (SDL_HasIntersection(&A, &B) == SDL_TRUE); } void UtilityClass::updateglow()