I saw that this is a common problem this days . So, this is just a Function that returns true when a Sprite is clicked , even if the window is moved. You can integrate this function in any project you want.
Thanks and Enjoy!
bool lf_bCheckForMouseTrigger(sf::Sprite &av_Sprite, sf::RenderWindow &av_Window) { int mouseX = sf::Mouse::getPosition().x; int mouseY = sf::Mouse::getPosition().y; sf::Vector2i windowPosition = av_Window.getPosition(); if(mouseX > av_Sprite.getPosition().x + windowPosition.x && mouseX av_Sprite.getPosition().y + windowPosition.y + 30 && mouseYCya next time.