That doesn't make much sense: you're trying to convert a rectangle in scene coordinates to scene coordinates (the fact that you have to cast your vector types is a good hint that something's wrong -- Vector2i defines
pixels)
I assume that "point" is mouse coordinates, as given by sf::Mouse::getPosition. I also assume that rect is the absolute bounding rect of an entity, as given by getGlobalBounds(). I also assume that the view that you mentioned is active in "window" when you call this function. (I wish I hadn't to assume so much stuff
)
Then it's simple: you just have to convert mouse coordinates to "scene" coordinates, that is, coordinates in the current window's view.
bool pointRect(const sf::Vector2i& point, sf::RectangleShape& rect, const sf::RenderWindow& window) {
return rect.contains(window.mapPixelToCoords(point));
}