Hi,
I have a custom entity class, like in the example, which has a simple bounding box for mouse click detection method -
bool Entity::isPointInside(sf::Vector2i input)
{
if(input.x > getPosition().x && input.x < getPosition().x+Texture.getSize().x &&
input.y > getPosition().y && input.y < getPosition().y+Texture.getSize().y)
{
return true;
}
return false;
}
This is working fine. I am using a View to zoom in and zoom out the viewport. The problem comes here, When the view is (0,0,1,1), everything works fine, but when I zoom out the view, the bounding box of the entity node still remains the same. So, changing the world coordinate to pixel does not work here.
Is there a way to get the position of the Enitity after zoom out, relative to the view rectangle area? So that I can re-update the bounding box which is a shape rectangle or there is any other way to detect the mouse click after zoom out?
Thank you.