Ok I have this code:
#include <iostream>
#include <SFML/Graphics.hpp>
int main(void)
{
// sf::RenderWindow window(sf::VideoMode(800,600),"Testing");
// window.setFramerateLimit(60);
sf::VertexArray line(sf::Lines,2);
line[0].position = sf::Vector2f(200,300);
line[1].position = sf::Vector2f(600,300);
sf::Rect<float> rect2(line.getBounds());
sf::Rect<float> rect(200,100,300,200);
sf::VertexArray drawrect(sf::Quads,4);
drawrect[0].position = sf::Vector2f(100,200);
drawrect[1].position = sf::Vector2f(400,200);
drawrect[2].position = sf::Vector2f(400,400);
drawrect[3].position = sf::Vector2f(100,400);
// while (window.isOpen())
// {
// window.clear(sf::Color::Black);
// window.draw(line);
// window.draw(drawrect);
// window.display();
// }
std::cout << rect.intersects(rect2);
}
You can uncomment to see what I have createn.
When I run this code, it always show 0 which mean there aren't intersection. But I think it should be 1, why not ?
If I were wrong, how to correct it ? I mean .. [ the title ]