I did some searching on the forum, but "Rect" "Intersect" "Negative" and the like are not the best search terms, so I apologise if this has been noted.
I held off posting on the tracker because I wanted to check if this is by design or a bug. If this is a bug I will happily toodle off to the Github and submit a patch.
Rectangles with a negative width/height do not seem to intersect properly with rectangles with positive width/height. For example, a rectangle at 0,0 with width and height of 10 should intersect with a rectangle at 15, 15 with a width and height of -10. In SFML they do not.
Here is the obligatory code snippet:
#include <SFML/System.hpp>
#include <iostream>
int main(int argc, char *argv[]) {
// intersect test
sf::IntRect rect1(0,0,10,10); //Rectangle at 0,0 with width of 10 and height of 10
sf::IntRect rect2(15,15,-10,-10); //Rectangle at 15,15 with width of -10 and height of -10
bool test1 = rect1.intersects(rect2);
std::cout << "Test 1 " << test1 << std::endl;
std::getchar();
return 0;
}
The output is:
Test 1 0
So clearly, the rectangles are considered to not intersect. Is this the intent?
For anyone interested in a more involved test, I've attached a .cpp that checks a couple different combinations.
[attachment deleted by admin]