Hello, i need help with mouse and rectangle collision. I had draw a rectangle if shop window should be open and tryed to get proper its locations x and location y, the problem is the mouse x and y position are global, while rectangle shows completele different numbers,
Here is example of the code
if (ShopKeeper1.shopOpen == true)
{
std::cout << "SHOP IS OPEN" << std::endl;
std::cout << shopOne.rect.getGlobalBounds().top << std::endl;
if(shopOne.rect.getGlobalBounds().contains(sf::Mouse::getPosition().x,sf::Mouse::getPosition().y))
{
std::cout << "MOUSE ON THE SHOP" << std::endl;
}
}
i can only get rectangles starting position which is 0, its width and height, if someone could help me out here would be appriciated.